首页 技术 正文
技术 2022年11月16日
0 收藏 324 点赞 4,336 浏览 2200 个字

Description

B – Avoiding a disaster

Percy likes to be punctual. So much so that he always keeps three watches with him, so that he can be sure exactly what the time is. However, Percy’s having a bad day. He found out that one of his watches was giving the wrong time. What’s worse, when he went to correct the watch, he corrected the wrong one! That is, one watch was running x minutes behind (where xB – Avoiding a disaster480) and he wound one of the other watches x minutes forward. He now has three watches reading three different times, and hence is in serious danger of being tardy. Can you help Percy by writing a program that takes in the three times displayed on the watches and returns the correct time?

Input

The input begins with an integer T indicating the number of cases that follow ( 0 < T < 100). Each of the following T lines contains one test case, made up of three readings, separated by single space characters: H1:M1H2:M2H3:M3 In each reading H1, H2, H3 represent the hours displayed ( 0 < H1, H2, H3 < 13), and M1, M2, M3 represent the minutes displayed ( 0B – Avoiding a disasterM1, M2, M3 < 60).

If the number of minutes is less than 10, a leading 0 is perpended.

Output

For each test case, one line should be produced, formatted exactly as follows: “The correct time is Hi:Mi“. If the number of minutes is less than 10, a leading 0 should be added. If the number of hours is less than 10, a leading 0 should NOT be added. If it is impossible to tell the time from the three readings, print the string: “Look at the sun“.

Sample Input

3
5:00 12:00 10:00
11:59 12:30 1:01
12:00 4:00 8:00

Sample Output

The correct time is 5:00
The correct time is 12:30
Look at the sun题意:时间 a b c 要求随意两个时间间隔相同 则输出中间的那个时间 否则输出 look at the sun
样例1 10 5 12 间隔分别是五
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <vector>
#include <iostream>
#include <algorithm>
#include <deque>
#include <ctime>
using namespace std;int main()
{
int n,i,j,t,m,a,b,h1,h2,h3;
int num[];
while(~scanf("%d",&n))
{
while(n--)
{
for(i=;i<;i++)
{
scanf("%d:%d",&a,&b);
num[i]=(a)*+b;
}
sort(num,num+);
h1=num[]-num[];
h2=num[]-num[];
h3=num[]-num[]+;
//cout<<num[0]<<' '<<num[1]<<' '<<num[2]<<endl;
//cout<<h1<<" "<<h2<<" "<<h3<<endl;
if(h1==h2&&h2==h3)
printf("Look at the sun\n");
else if(h1==h2&&h1!=h3)
printf("The correct time is %d:%02d\n",num[]/,num[]%);
else if(h2==h3&&h2!=h1)
printf("The correct time is %d:%02d\n",num[]/,num[]%); ///%02d
else if(h3==h1&&h3!=h2)
printf("The correct time is %d:%02d\n",num[]/,num[]%);
else
printf("Look at the sun\n");
}
} return ;
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,105
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,582
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,429
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,836
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,919