FZU 1857 Clock in the mirror(坑题)

Yr is on the English class,she is so sleepy that she want to know how long the class will last.So,she try to find out the current time.But the only clock is on the back wall of the classroom,and frequent turning might offend the teacher. 
 Clever as she is, Yr take out a mirror.Now,she can see the clock in the mirror.Unfortunately,the time in the mirror maybe not the real time.Now,it’s time for you to do her a favor.She will give you the time in the mirror and ask you to tell her the real time.
Input
Multiple cases. 
Each case shows in one line as the format: hh:mm 
All legal time is show in 12 hours system.
Output
One line for each case.Please output the real time in 12 hours system according to the time given in the format hh:mm.If the time YR tell you is illegal,please out put ”That is a joke.”.
Sample Input
9:00
12:00
Sample Output
03:00
That is a joke.

【题解】

 这道题,emmmm...哇了好几发,原因就是它的数据里分钟还能读出大于60的,,真的坑。

 代码很简单。


【AC代码】

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<math.h>
#include<cmath>
using namespace std;
const int N = 20000;

int main()
{
    int m,n;
    while(~scanf("%d:%d",&m,&n))
    {
        int x,y;
        if(m >=12||n>=60)
        {
            printf("That is a joke.\n");
            continue;
        }
        if(n == 0)
        {
            x = 12-m;
            y = 0;
        }
        else
        {
            x = 12-m-1;
            y = 60-n;
        }
        printf("%02d:%02d\n",x == 12?0:x,y);
    }
    return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值