c语言 3、5wa 其他ac 求大佬指点迷津

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

“**输出 HH:MM 的时间格式,不足两位时补零。**” **需要加上前缀0** 方法:**可以在 min 和 hour 在特定范围时特判。** ------------ 我的代码: ```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:55:39


我也是三五不行,找了一两个钟了都没发现问题
by lh1412 @ 2023-01-30 21:57:36


|