题解 | #小乐乐定闹钟#
小乐乐定闹钟
http://www.nowcoder.com/practice/0f7e422e12be4a7f9958ca2a82abc775
#include<stdio.h>
int main()
{
int hour = 0;
int minute = 0;
int k = 0;
scanf("%d:%d %d", &hour, &minute, &k);
minute = minute + k % 60;
hour = hour + k / 60;
if (minute >= 60)
{
minute = minute % 60;
hour++;
}
hour = hour%24;
if (hour > 9&&minute>9)
{
printf("%d:%d", hour, minute);
}
else if(hour <= 9 && minute > 9)
{
printf("0%d:%d", hour, minute);
}
else if (hour > 9 && minute <= 9)
{
printf("%d:0%d", hour, minute);
}
else
{
printf("0%d:0%d", hour, minute);
}
return 0;
}