CodeForces 622B
来源:互联网 发布:智慧环保大数据平台 编辑:程序博客网 时间:2024/06/05 09:15
You are given the current time in 24-hour formathh:mm. Find and print the time after a minutes.
Note that you should find only the time after a minutes, see the examples to clarify the problem statement.
You can read more about 24-hour format here https://en.wikipedia.org/wiki/24-hour_clock.
The first line contains the current time in the format hh:mm (0 ≤ hh < 24, 0 ≤ mm < 60). The hours and the minutes are given with two digits (the hours or the minutes less than10 are given with the leading zeroes).
The second line contains integer a (0 ≤ a ≤ 104) — the number of the minutes passed.
The only line should contain the time after a minutes in the format described in the input. Note that you should print exactly two digits for the hours and the minutes (add leading zeroes to the numbers if needed).
See the examples to check the input/output format.
23:5910
00:09
20:20121
22:21
10:100
10:10
题意:给你一个时间,问过了一定分钟后,该时间是多少。
解法:模拟
#include <iostream>
#include<stdio.h>
#include<queue>
#include<string.h>
#include<stack>
#include<map>
using namespace std;
#define ll long long int
int main()
{
//freopen("in.txt","r",stdin);
int hh,mm,mint;
char c;
scanf("%d%c%d",&hh,&c,&mm);
scanf("%d",&mint);
mint=mint%(24*60);
mm=mm+mint%60;
if(mm>=60)
{
mm=mm%60;
hh++;
}
hh=(hh+mint/60)%24;
if(hh<10) printf("0");
printf("%d:",hh);
if(mm<10)printf("0");
printf("%d",mm);
return 0;
}
- CodeForces 622B
- CodeForces 622B - The Time
- CodeForces 622B The Time
- codeforces B
- codeforces B
- codeforces B
- codeforces B
- Codeforces 622B The Time 【水题】
- CodeForces 622 B. The Time(水~)
- CodeForces 626B CodeForces 626B【暴力】
- CodeForces 841B (B) 博弈
- codeforces 134B
- codeforces#98 b
- codeforces 105 div2 B
- Codeforces 166B - Polygons
- codeforces B. Coins
- codeforces----193B Xor
- codeforces----208B Solitaire
- linux TOP命令各参数详解【转载】
- 如何修改hosts
- 织梦dedecms如何自动获取当前系统时间
- 类的定义3
- OSX下同时安装opencv2 和 opencv3
- CodeForces 622B
- build模式小例子
- python实现监控服务器的UDP丢包情况
- 状态栏的图标与文字提醒(NotificationManager与Notification对象的应用)
- c++线程回调函数调用类成员函数方法-续集
- xcode中的配置环境变量
- 一些经常被问到的知识整理
- 共享栈
- mongo性能测试demo 代码正确运行