题解 | #小乐乐定闹钟#

小乐乐定闹钟

https://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);
	int c = (int)(hour+(k / 60) % 24);
	if (c > 24) {
		c %= 24-1;
	}
	int d = (int)(minute+(k % 60));
	if (d > 60) {
		d %= 60;
	}
	printf("%02d:%02d", c, d);
}

全部评论

相关推荐

评论
1
收藏
分享
牛客网
牛客企业服务