题解 | #小乐乐定闹钟#
小乐乐定闹钟
https://www.nowcoder.com/practice/0f7e422e12be4a7f9958ca2a82abc775
#include <stdio.h> int main() { int hour, minute, k; while ((scanf("%d:%d %d", &hour, &minute, & k) == 3)) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to int minutes = hour * 60 + minute + k; //计算所有分钟数 if (minutes / 60 < 24) { printf("%#02d:%#02d\n", minutes / 60, minutes % 60); } else { printf("%#02d:%#02d\n", minutes / 60 % 24, minutes % 60); } } return 0; }