#include <stdio.h>int main(void){ int hour, min, sec; int totalsec; scanf("%d %d %d", &hour, &min, &sec); if(hour<0 || min<0 || sec<0) { return; } scanf("%d", &totalsec); sec+=totalsec; if(totalsec>500000 && totalsec<0) { return; } if(sec>=60) { min+=sec/60; sec=sec%60; if(min>=60) { hour+=min/60; min=min%60; if(hour>=24) { hour/=24; } } } printf("%d %d %d", hour, min, sec); return 0;}이렇게 작성했는데 틀렸습니다라고 계속
문제 번호가 없네여
댓글을 작성하려면 로그인해야 합니다.
thdwlsgus0 7년 전
#include <stdio.h>
int main(void)
{
int hour, min, sec;
int totalsec;
scanf("%d %d %d", &hour, &min, &sec);
if(hour<0 || min<0 || sec<0)
{
return;
}
scanf("%d", &totalsec);
sec+=totalsec;
if(totalsec>500000 && totalsec<0)
{
return;
}
if(sec>=60)
{
min+=sec/60;
sec=sec%60;
if(min>=60)
{
hour+=min/60;
min=min%60;
if(hour>=24)
{
hour/=24;
}
}
}
printf("%d %d %d", hour, min, sec);
return 0;
}
이렇게 작성했는데 틀렸습니다라고 계속