求助,第七个测试点过不了

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

@[silver_eagle](/user/1399384) 我的AC代码 ```cpp #include<bits/stdc++.h> using namespace std; int main() { long double s,v; long int s2=470; cin>>s>>v; s=s/v; int d=s; if(s>d) { d+=1; } s2-=d; int h=s2/60; int m=s2-h*60; if(h>=0&&m>=0) { if(h<10) { cout<<'0'<<h; } else { cout<<h; } cout<<':'; if(m<10) { cout<<'0'<<m; } else { cout<<m; } } else { if(m==0) { h=24+h; } else { h=23+h; m=60+m; } if(h<10) { cout<<'0'<<h; } else { cout<<h; } cout<<':'; if(m<10) { cout<<'0'<<m; } else { cout<<m; } } }
by AI9527 @ 2024-08-18 16:36:44


@[silver_eagle](/user/1399384) ac代码: ```cpp #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 Emil_ @ 2024-08-18 16:38:06


@[Emil_](/user/1393222) 感谢QAQ
by silver_eagle @ 2024-08-18 20:22:33


@[AI9527](/user/1271328) 感谢
by silver_eagle @ 2024-08-18 20:22:53


~~本蒟蒻的有点长,给你看看~~ ```cpp #include<bits/stdc++.h> #define int long long using namespace std; signed main(){ int a,b; cin>>a>>b; int h=0,m=0; int time=a/b+10,lass=0,lass2=0; if(a%b!=0){ time++; } if(time>480){ lass=time-480; lass2=24*60-lass; h=floor(lass2/60); if(h<10){ cout<<"0"<<h<<":"; } else{ cout<<h<<":"; } m=lass2-60*h; if(m<10){ cout<<"0"<<m; } else{ cout<<m; } } else{ lass=480-time; h=floor(lass/60); if(h<10){ cout<<"0"<<h<<":"; } else{ cout<<h<<":"; } m=lass-60*h; if(m<10){ cout<<"0"<<m; } else{ cout<<m; } // cout<<h<<":"<<m; } return 0; } ```
by Stars_Shine @ 2024-08-19 14:11:29


|