Big Ben

Big Ben

time limit
400 ms
memory limit
65536 kB
code length limit
8000 B
Judgment procedure
Standard
author
Chen Yue

There is a guy who calls himself "Big Ben V" on Weibo, ringing the bell every day to urge code farmers to take care of their bodies and go to bed early. However, since Ben's own schedule is not very regular, the bell is not timed. Generally, the number of points for ringing the bell is determined according to the time of ringing the bell. If it happens to be struck at a certain hour, then the "when" number is equal to that whole point; if it is after the whole point, the next whole point is struck. In addition, although there are 24 hours in a day, the clock only strikes 1 to 12 times in the second half of the day. For example, ringing the bell at 23:00 is "dangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdangdang". Between 00:00 midnight and 12:00 noon (endpoint time inclusive), the ben bell does not strike.

Next, please write a program to ring the bell for Big Ben according to the current time.

Input format:

The first line of input gives the current time in the format "hh:mm". where hh is the hour, between 00 and 23; mm is the minute, between 00 and 59.

Output format:

Ring the bell for Big Ben according to the current time, that is, output the corresponding number of "Dang" in one line. If it is not a bell period, output:

Only hh:mm.  Too early to Dang.

where "hh:mm" is the entered time.

Input sample 1:
19:05
Sample output 1:
DangDangDangDangDangDangDangDangDang
Input sample 2:
07:05
Sample output 2:
Only 07:05.  Too early to Dang.
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int m,n;
    scanf("%d:%d",&m,&n);
    if(((m==12)&&(n>0))||(m>12)){
        int t=m-12;
        if(n>0)
            t++;
        for(int i=1;i<=t;i++)
            cout<<"Dang";
        cout<<endl;
    }
    else
        printf("Only %02d:%02d. Too early to Dang.\n",m,n);//There are two spaces in front of Too, it is recommended to copy
return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325670379&siteId=291194637