zoukankan      html  css  js  c++  java
  • Educational Codeforces Round 7 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 test(s)
    input
    23:59
    10
    output
    00:09
    input
    20:20
    121
    output
    22:21
    input
    10:10
    0
    output
    10:10
    一个简单的模拟
     1 #include<stdio.h>
     2 //#include<bits/stdc++.h>
     3 #include<string.h>
     4 #include<iostream>
     5 #include<math.h>
     6 #include<sstream>
     7 #include<set>
     8 #include<queue>
     9 #include<map>
    10 #include<vector>
    11 #include<algorithm>
    12 #include<limits.h>
    13 #define inf 0x3fffffff
    14 #define INF 0x3f3f3f3f
    15 #define lson l,m,rt<<1
    16 #define rson m+1,r,rt<<1|1
    17 #define LL long long
    18 #define ULL unsigned long long
    19 using namespace std;
    20 int t;
    21 int n,m;
    22 int sum,ans,flag;
    23 int a,b,c,d;
    24 int main()
    25 {
    26     scanf("%d:%d",&a,&b);
    27     scanf("%d",&n);
    28     while(n--)
    29     {
    30         b++;
    31         if(b==60)
    32         {
    33             a++;
    34             b=0;
    35             if(a==24)
    36             {
    37                 a=0;
    38             }
    39         }
    40     }
    41     printf("%02d:%02d",a,b);
    42     return 0;
    43 }
  • 相关阅读:
    表单
    表格的应用
    图像与超链接
    HTML基础(部分标签的应用)
    DataFrame合并数据df.append
    DataFrame处理接口返回数据
    pandas读取excel文件
    数据加载、存储于文件格式:二进制数据格式pickle
    AttributeError: 'DataFrame' object has no attribute 'save'
    web信息收集:获取所有url
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/5186840.html
Copyright © 2011-2022 走看看