7-2 然后是几点 (15分)
程序员文章站
2022-06-07 10:37:16
...
要设置很多变量就是取名字有点麻烦,题不是难题,各种if else就可以做,逻辑清晰的话很快就能AC
#include <stdio.h>
int main(){
int originTime,addTime,curTime;
scanf("%d %d",&originTime,&addTime);
int addh = addTime/60;
int addf = addTime%60;
int i=0;
int orih = originTime/100,orif = originTime%100;
int a,b;//a是最后的小时,b是分钟
if(orif+addf>=0){
b = (orif+addf)%60;
a = (orif+addf)/60+orih+addh;
}else{
b = 60+(orif+addf)%60;
a = (orif+addf)/60+orih+addh-1;
}
printf("%d%02d",a,b);
}
上一篇: 患有湿疹吃什么水果好得快!
下一篇: 7-2 然后是几点 (15分)