题解 | #小乐乐定闹钟#
小乐乐定闹钟
https://www.nowcoder.com/practice/0f7e422e12be4a7f9958ca2a82abc775
#include <stdio.h> int main() { //定义变量及输入 int n = 0; int m = 0; int k = 0; int count = 0; char ch; scanf("%d%c%d%d",&n,&ch,&m,&k); int sum = m+k; //功能主体 while(sum>=60) { ++count; sum-=60; } if(n+count>=10) { if((n+count)>=24) { if(((n+count)%24)<10 && sum<10) { printf("0%d%c0%d",(n+count)%24,ch,sum); goto loop; } printf("%d%c%d",(n+count)%24,ch,sum); goto loop; } printf("%d%c%d",n+count,ch,sum); } else if((n+count)<10) { printf("0%d%c%d",n+count,ch,sum); } loop: return 0; }