题解 | #小乐乐定闹钟#
小乐乐定闹钟
https://www.nowcoder.com/practice/0f7e422e12be4a7f9958ca2a82abc775
#include <stdio.h> int main() { int h,m,k; scanf("%d:%d %d", &h, &m,&k); int b=m+k%60; if(0 <= h &&h<= 23&&0 <= m&&m<=59&&1 <= k)//限制条件 { if(b<60) { printf("%02d:%02d",(h+k/60)%24,b); //一天24h,如果结果h>24,%24即可 } else {//b>=60 h就会变 printf("%02d:%02d",(k/60+b/60+h)%24,b%60); } } return 0; }