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.
Multiple cases.
Each case shows in one line as the format: hh:mm
All legal time is show in 12 hours system.
Each case shows in one line as the format: hh:mm
All legal time is show in 12 hours system.
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.”.
9:00 12:00
03:00 That is a joke.
题解:
有点意思的一题,给你一个时间,求镜面钟的时间(正过来反过来都可以),要注意有坑点,就是当m不为0的时候h--
代码:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<stdlib.h>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
#define lson k*2
#define rson k*2+1
#define M (t[k].l+t[k].r)/2
#define ll long long
#define INF 10086111
int main()
{
int h,m;
while(scanf("%d:%d",&h,&m)!=EOF)
{
if(h<0||h>=12||m<0||m>=60)
{
printf("That is a joke.\n");
continue;
}
m=60-m;
if(m==60)
m=0;
h=12-h;
if(m!=0)
h--;
if(h==12)
h=0;
printf("%02d:%02d\n",h,m);
}
return 0;
}