Educational Codeforces Round 7 B. The Time 水题
B. The Time
题目连接:
http://www.codeforces.com/contest/622/problem/B
Description
You are given the current time in 24-hour format hh: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.
Input
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 than 10 are given with the leading zeroes).
The second line contains integer a (0 ≤ a ≤ 104) — the number of the minutes passed.
Output
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.
Sample Input
23:59
10
Sample Output
00:09
Hint
题意
给你现在的时间,然后问你过了k分钟后,是几点了
题解:
水题啦,题数喜+1
代码
#include<bits/stdc++.h>
using namespace std;
string s;
int h,m,ss;
int main()
{
cin>>s;
for(int i=0;i<2;i++)
h=h*10+(s[i]-'0');
for(int i=3;i<s.size();i++)
m=m*10+(s[i]-'0');
cin>>ss;
m +=ss;
int k = m/60;
m=m%60;
h=(h+k)%24;
printf("%02d:%02d\n",h,m);
}
Educational Codeforces Round 7 B. The Time 水题的更多相关文章
- Educational Codeforces Round 7 A. Infinite Sequence 水题
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...
- Educational Codeforces Round 11 A. Co-prime Array 水题
A. Co-prime Array 题目连接: http://www.codeforces.com/contest/660/problem/A Description You are given an ...
- Educational Codeforces Round 10 C. Foe Pairs 水题
C. Foe Pairs 题目连接: http://www.codeforces.com/contest/652/problem/C Description You are given a permu ...
- Educational Codeforces Round 24 CF 818 A-G 补题
6月快要结束了 期末也过去大半了 马上就是大三狗了 取消了小学期后20周的学期真心长, 看着各种北方的学校都放假嗨皮了,我们这个在北回归线的学校,还在忍受酷暑. 过年的时候下定决心要拿块ACM的牌子, ...
- Educational Codeforces Round 5(A,B题)
虽然是水题但还是贴下代码把 A #include<cstring> #include<cstdio> using namespace std; ; char x[qq],y[q ...
- Codeforces Round #300 A. Cutting Banner 水题
A. Cutting Banner Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/pro ...
- Educational Codeforces Round 2 A. Extract Numbers 模拟题
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...
- Codeforces Round #300 D. Weird Chess 水题
D. Weird Chess Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/proble ...
- Codeforces Round #300 B. Quasi Binary 水题
B. Quasi Binary Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/probl ...
随机推荐
- 使用Firebug和FirePHP调试PHP
大家都知道Firebug,可能不知大FirePHP,它也是FireFox插件用来调试PHP的,首先确保你安装了Firebug,然后再去安装FirePHP,这是你会看到Firebug多了一只蓝色的虫: ...
- 实现两个N*N矩阵的乘法,矩阵由一维数组表示
实现两个N*N矩阵的乘法,矩阵由一维数组表示. 先介绍一下矩阵的加法: void Add(int rows, int cols) { ;i<rows;i++) { ;j<cols;j++) ...
- delphi中通过CreateOleObject操控Word
http://blog.csdn.net/csm2432/article/details/7692443
- delphi 怎么把image上的图片粘贴到剪切板上
这个给你一个简单的代码,仅提供思路. uses Clipbrd; //引用单元 procedure TForm1.Button1Click(Sender: TObject); var Bmp: TBi ...
- 【转】从外行的视角尝试讲解为什么这回丰田栽了【全文完】【v1.01】
转自:http://club.tgfcer.com/thread-6817371-1-1.html [第一部分]背景简介 前几年闹得沸沸扬扬的丰田刹不住事件最近又有新进展.十月底俄克拉荷马的一次庭审 ...
- ORACLE TM锁
Oracle的TM锁类型 锁模式 锁描述 解释 SQL操作 0 none 1 NULL 空 Select 2 SS(Row-S) 行级共享锁,其他对象只能查询这些数据行 Select for upda ...
- php codeigniter (CI) oracle 数据库配置-宋正河整理
database.php 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 $active_group = 'default'; $active_record ...
- C语言的 (强制类型转换) 以及 '字符字面值'
C语言的显式/隐式类型转换,都有一个中间变量的存在,原数据的类型.内容都不变. 以下代码,都用GCC编译. #include<stdio.h> int main() { char c = ...
- 重新开始吧(ADB+AndroidManifest.xml)
我现在默认已经搭建好了开发环境.如果没有,可以参见去Google一下,或者我上两篇文章中也有提到. 先补充一点: SDK不用FQ.也能更新 修改hosts文件 下载sdk版本: 在hosts文件中追加 ...
- .NET异步编程初识async与await
这是两个关键字,用于异步编程.我们传统的异步编程方式一般是Thread.ThreadPool.BeginXXX.EndXXX等等.把调用.回调分开来,代码的逻辑是有跳跃的,于是会导致思路不是很清晰的问 ...