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 }
  • 相关阅读:
    DES 加密算法
    socket编程之bind()函数
    如何启动ubuntu下的telnet服务
    基于duilib修改的版本上传了
    mmsPlayer, for android ,wince,windows,wm等
    [转]log4c 配置文件的用法
    mmsPlayer, for android ,wince,windows,wm等
    wince 版本的播放器 是基于 TC89系列
    cocos2dx做的一个圣诞节软件
    基于duilib修改的版本上传了
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/5186840.html
Copyright © 2011-2022 走看看