题解
2025-07-10 22:19:49
发布于:江西
17阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,h=0,m=0,s=0;
cin>>t;
s=t;
if(s>=60){
m=s/60;
s=s%60;
}
if(m>=60){
h=m/60;
m=m%60;
}
cout<<setw(2)<<setfill('0')<<h<<":";
cout<<setw(2)<<setfill('0')<<m<<":";
cout<<setw(2)<<setfill('0')<<s;
return 0;
}
全部评论 3
:P
2025-07-10 来自 江西
1这种写法比较偷懒,但有用。
2025-07-10 来自 江西
1cout<<setw(n)<<setfill('ch')<<x;
用于以n格宽输出x,不足以setfill中的ch补足,ch默认为空格
2025-07-10 来自 江西
1
有帮助,赞一个