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 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
随机推荐
- 快速清除MS SQL SERVER 日志
USE [master] GO ALTER DATABASE yourdatabase SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE yourd ...
- Yii2实用基础学习笔记(二):Html助手和Request组件 [ 2.0 版本 ]
Html助手 1 .在@app\views\test的index.php中: <?php //引入命名空间 use yii\helpers\Html; ?> <?php //[一]表 ...
- 第4章 URL管理器和实现方法
URL管理器:管理待抓取URL集合和已抓取URL集合 -- 防止重复抓取.防止循环抓取 URL需要支持哪些功能: 添加新URL到待爬取集合中.判断待添加URL是否在容器中,判断是否还有待爬取URL,获 ...
- VC++MFC对话框程序中给对话添加背景图片
VC对话框怎么显示背景图片呢.在MFC中实现背景图片,不像C#应用程序那么简单.今天就和朋友们说说如何在VC界面中设置背景图片 ^_^ 工具/原料 Visual C++ 2010 方法一:用Pic ...
- Zipper (DP)
Zipper Given three strings, you are to determine whether the third string can be formed by combining ...
- (比赛)B - Super Mobile Charger
B - Super Mobile Charger Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- (比赛)A - Simple String Problem
A - Simple String Problem Time Limit:10000MS Memory Limit:65536KB 64bit IO Format:%lld & ...
- elasticsearch从入门到出门-03-多种搜索
1.query string search 2.query DSL 3.query filter 4.full-text search 5.phrase search 6.highlight sear ...
- springboot工程自动生成工具
1 springboot工程自动生成网址 http://start.spring.io/ 2 工具 Spring Boot CLI
- Windows存储管理之磁盘类型简介
各种操作系统连接到存储系统之后,并且操作系统识别物理磁盘之后,需要对磁盘进行进一步配置.如果用户连接存储是的Windows Server,存储管理员势必需要了解Windows中的磁盘类型与文件系统.笔 ...