列表

详情


NC15531. Unpredictable Accidents

描述

Due to unpredictable accidents, The Third Chang′an University ACM−ICPC Programming Competition will be postponed for x minutes. We have known that the competition should have started at 12:00, and the duration of it is 5 hours. As a participant, you want to know when is the ending time.
Please print the ending time in the form of hh:mm, hh is the hours with range of 00 to 24 and the mm is the minutes with range of 00 to 59.


输入描述

The first line contains an integer number T,the number of test cases.
ith of each next T lines contains an integer x(1≤x≤300), the number of minutes competition will postpone.

输出描述

For each test case print the the ending time in the form of hh:mm.

示例1

输入:

3
5
70
120

输出:

12:05
13:10
14:00

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

C 解法, 执行用时: 2ms, 内存消耗: 356K, 提交时间: 2021-06-24 12:01:25

#include <stdio.h>
int main ()
{
    int n,t;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&t);
        printf("%d:%02d\n",12+t/60,t%60);
    }
	return 0;
}

C++11(clang++ 3.9) 解法, 执行用时: 3ms, 内存消耗: 464K, 提交时间: 2018-04-14 17:23:44

#include"stdio.h"
int main()
{
int t,sj;
scanf("%d",&t);
while(t--)
{
	scanf("%d",&sj);
	printf("%d:%.2d\n",12+sj/60,sj%60);
}
	return 0;
}

Python3(3.5.2) 解法, 执行用时: 19ms, 内存消耗: 3320K, 提交时间: 2020-10-10 20:02:48

a=int(input())
for i in range(a):
    b=int(input())
    c=b//60+12
    c=c%24
    b=b%60
    print('{:02d}:{:02d}'.format(c,b))

上一题