codeforces 622B B. The Time
1 second
256 megabytes
standard input
standard output
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.
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.
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:59
10
00:09
20:20
121
22:21
10:10
0
10:10
题意:问从起点时间经过所给的时间,终点时间是多少;
思路:将时间都转换成分钟;
AC代码:
#include <bits/stdc++.h>
using namespace std;
char str[8];
int a;
int main()
{
scanf("%s",str);
scanf("%d",&a);
int x1,x2;
x1=(str[0]-'0')*10+(str[1]-'0');
x2=(str[3]-'0')*10+(str[4]-'0');
//cout<<x1<<":"<<x2<<"\n";
x2+=a;
x1+=x2/60;
x2%=60;
x1%=24;
if(x1<10)printf("0%d:",x1);
else printf("%d:",x1);
if(x2<10)printf("0%d\n",x2);
else printf("%d\n",x2);
return 0;
}
codeforces 622B B. The Time的更多相关文章
- Codeforces 622B The Time 【水题】
B. The Time time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- CodeForces 622B The Time
水题. #include <stdio.h> #include <algorithm> #include <string.h> #include <queue ...
- codeforces622B
The Time CodeForces - 622B 给你当前的时间(24小时制):HH:MM.输出 x 分钟后的时间是多少?(24小时制) 不明白可以看看例子哦- Input 第一行给出了当前时间, ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
随机推荐
- 查看apache,nginx,mysql,linux,php版本
查看apache版本 /usr/sbin/apachectl -v httpd -v 安装目录,使用apachectl -v mysql版本查看 mysql -V 查看linux版本 1.cat /e ...
- android--SDK Manager下载Connection to http://dl-ssl.google.com refused
错误 Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-6.xml, reason: Connec ...
- ios输出想保留的整数位(占位符)
int startHour=5; int startMinute=4; //输出前面补0,不管你输入的数据前面有没有0 sp;NSLog(@"====>%@",[NSStri ...
- mxnet编译问题手记
MXNet在64位Win7下的编译安装:https://www.cnblogs.com/noahzn/p/5506086.html http://blog.csdn.net/Jarvis_wxy/ar ...
- redis-windows和linux下安装
Window 下安装 下载地址:https://github.com/dmajkic/redis/downloads. 下载到的Redis支持32bit和64bit.根据自己实际情况选择,将64bit ...
- java jdbc连接数据库,Properties 属性设置参数方法
今天在整合为数据库发现在配置中实现的赋值方式,可以用代码实现.特记录下共以后参考: 代码: // 操作数据库 Connection conn; String strData ...
- 九度OJ 1180:对称矩阵 (矩阵计算)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2637 解决:1354 题目描述: 输入一个N维矩阵,判断是否对称. 输入: 输入第一行包括一个数:N(1<=N<=100),表 ...
- Frobenius Norm
http://mathworld.wolfram.com/FrobeniusNorm.html
- Mac标识物理位置算法 import Levenshtein mac列表特征值
mac 字符串 与 基准字符串的 Levenshtein 距离,考虑 mac信号强度的时序性,60秒内若干次变化 不引入强度 mac字符串的唯一性 如何排序 基准字符串的选取 同一尺度 都按强度 ...
- Webpack探索【5】--- plugins详解
本文主要讲plugins相关内容. https://gitbook.cn/gitchat/column/59e065f64f7fbe555e479204/topic/59e96d87a35cf44e1 ...