## “输出 `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:42:07