70分求助,后三个点WA

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

_“由于路途遥远, yyy 可能不得不提前一天出发,不过不可能提前超过一天。”_ ------------ **h可能大于8,需要特判。** 我的代码: ```cpp #include <bits/stdc++.h> using namespace std; int main(){ int s,v; cin>>s>>v; int t=s/v; if(t*v!=s) t++; //整除的特判 t+=10; int h,m; h=7-t/60; m=t%60; //计算 t,h if(h<0) h+=24; //又是一天 if(h<10) cout<<"0"<<h<<":"; else cout<<h<<":"; if(m>50) cout<<"0"<<60-m; else cout<<60-m; //"0"的特判 return 0; } ```
by HWX_Xuan @ 2022-12-19 13:59:03


|