20分,不知道错哪里,手搓样例全部通过

P5707 【深基2.例12】上学迟到


by lyl__lxly @ 2024-07-09 10:46:44


```cpp #include<iostream> using namespace std ; int main() { int w , h ; cin >> w >> h ; int ans = w / h ; if( w % h != 0 ) { ans++ ; } ans += 10 ; int r = 1 ; while( ans >= 60 ) { r++ ; ans -= 60 ; } if( r <= 8 ) { cout << 0 << 8 - r << ":" ; } else { r -= 8 ; if( 24 - r < 10 ) { cout << 0 ; } cout << 24 - r << ":" ; } if( 60 - ans < 10 ) { cout << 0 ; } cout << 60 - ans ; return 0 ; } ``` # 错了私信我
by Hhy140516 @ 2024-07-09 11:12:08


@[lyl__lxly](/user/1360723) **代码贴上,求关** ```c #include <bits/stdc++.h> using namespace std; double s,v,m; int n,a,t,b; int main() { cin>>s>>v; n=8*60+24*60; t=ceil(s/v)+10; n=n-t; if(n>=24*60) n-=24*60; b=n%60; a=n/60; if(a<10) { if(b<10) cout<<"0"<<a<<":0"<<b; else cout<<"0"<<a<<":"<<b; } else { if(b<10) cout<<a<<":0"<<b; else cout<<a<<":"<<b; } return 0; } ```
by Maisie586_ @ 2024-07-09 11:59:45


|