int Sec2HMS(int second) { int S = second % 60, tempM = (second - S) / 60; int M = tempM % 60, H = (tempM - M) / 60; return H * 10000 + M * 100 + S; }
input:0 output:0
来来来我来给你们送福利了,超级嵌套√,如果不是和我一样闲得无聊别这么干
#include int main() { int s; scanf(“%d”,&s); int h1,h2,m1,m2,s1,s2; h1=s/36000; if(h1>0){h2=(s-36000h1)/3600;} else h2=s/3600; m1=(s-36000h1-3600h2)/600; if(m1>0){m2=(s-36000h1-3600h2-600m1)/60;} else{m2=(s-36000h1-3600h2-600m1)/60;} s1=(s-36000h1-3600h2-600m1-60m2)/10; if(s1>0){s2=(s-36000h1-3600h2-600m1-60m2-10s1);} else{s2=(s-36000h1-3600h2-600m1-60m2-10*s1);} if(h1==0) { if(h2==0) { if(m1==0) { if(m2==0) { if(s1==0) { printf(“%d”,s2); }else printf(“%d%d”,s1,s2); }else printf(“%d%d%d”,m2,s1,s2); }else printf(“%d%d%d%d”,m1,m2,s1,s2); }else printf(“%d%d%d%d%d”,h2,m1,m2,s1,s2); }else printf(“%d%d%d%d%d%d”,h1,h2,m1,m2,s1,s2);
}
什么题目啊,居然不通过,肯定是题目有问题
int Sec2HMS(int second) {
int S = second % 60, tempM = (second - S) / 60;
int M = tempM % 60, H = (tempM - M) / 60;
return H * 10000 + M * 100 + S;
}
input:0
output:0
来来来我来给你们送福利了,超级嵌套√,如果不是和我一样闲得无聊别这么干
include
#include
int main()
{
int s;
scanf(“%d”,&s);
int h1,h2,m1,m2,s1,s2;
h1=s/36000;
if(h1>0){h2=(s-36000h1)/3600;}
else h2=s/3600;
m1=(s-36000h1-3600h2)/600;
if(m1>0){m2=(s-36000h1-3600h2-600m1)/60;}
else{m2=(s-36000h1-3600h2-600m1)/60;}
s1=(s-36000h1-3600h2-600m1-60m2)/10;
if(s1>0){s2=(s-36000h1-3600h2-600m1-60m2-10s1);}
else{s2=(s-36000h1-3600h2-600m1-60m2-10*s1);}
if(h1==0)
{
if(h2==0)
{
if(m1==0)
{
if(m2==0)
{
if(s1==0)
{
printf(“%d”,s2);
}else printf(“%d%d”,s1,s2);
}else printf(“%d%d%d”,m2,s1,s2);
}else printf(“%d%d%d%d”,m1,m2,s1,s2);
}else printf(“%d%d%d%d%d”,h2,m1,m2,s1,s2);
}else printf(“%d%d%d%d%d%d”,h1,h2,m1,m2,s1,s2);
}
什么题目啊,居然不通过,肯定是题目有问题