时间换算 题目答案PTA测试点 题目 答案 #include<stdio.h> int main() { int hour,minute,second; scanf("%d:%d:%d",&hour,&minute,&second); int extra,temp,temp1; scanf("%d",&extra); if(second+extra<60) printf("%02d:%02d:%02d",hour,minute,second+extra); else { temp=(extra+second)/60; second=(extra+second)%60; if(minute+temp<60) printf("%02d:%02d:%02d",hour,minute+temp,second); else { temp1=(minute+temp)/60; minute=(minute+temp)%60; if(hour+temp1<24) printf("%02d:%02d:%02d",hour+temp1,minute,second); else { hour=(hour+temp1)%24; printf("%02d:%02d:%02d",hour,minute,second); } } } } PTA测试点