#include<stdio.h>
typedef struct time{
int hour;
int minute;
int second;
}time;
int main()
{
time a;
int n;
scanf("%d:%d:%d",&a.hour,&a.minute,&a.second);
scanf("%d",&n);
a.second+=n;
if(a.second>=60){
a.minute++;
a.second-=60;
}
if(a.minute>=60){
a.hour++;
a.minute-=60;
}
if(a.hour>=24){
a.hour-=24;
}
printf("%02d:%02d:%02d",a.hour,a.minute,a.second);
return 0;
}
PTA习题9-1 时间换算(15 分)
最新推荐文章于 2023-11-26 12:30:26 发布
这篇博客主要介绍了如何解决PTA平台上的9-1题,该题目涉及时间单位的换算问题,包括分钟、小时和天之间的相互转换。博主详细解析了转换的数学原理,并提供了求解此类问题的步骤和示例。
&spm=1001.2101.3001.5002&articleId=82386453&d=1&t=3&u=9f86ba6013ae44d4a96fc6cc25badc9a)
1877

被折叠的 条评论
为什么被折叠?



