Description

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 x480) 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 ( 0M1, 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 ;
}

B - Avoiding a disaster的更多相关文章

  1. HDU 4177 模拟时间问题

    Avoiding a disaster Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Othe ...

  2. track message forwards, avoiding request loops, and identifying the protocol capabilities of all senders along the request/response chain

    https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html The TRACE method is used to invoke a remote, ...

  3. 读Avoiding the Disk Bottleneck in the Data Domain Deduplication File System

    最近在思考和实践怎样应用重复数据删除技术到云存储服务中.找了些论文来读,其中<Avoiding the Disk Bottleneck in the Data Domain Deduplicat ...

  4. Disaster Recovery, High Availability, and Continuous Availability - What's the Difference?

    Disaster Recovery, High Availability, and Continuous Availability - What's the Difference? Posted by ...

  5. Avoiding PostgreSQL database corruption

    TL;DR: Don't ever set fsync=off, don't kill -9 the postmaster then deletepostmaster.pid, don't run P ...

  6. PLSQL_性能优化工具系列16_Best Practices: Proactively Avoiding Database

    占位符 PLSQL_性能优化工具系列_Best Practices: Proactively Avoiding Database/Query Performance Issue

  7. Performing a full database disaster recovery with RMAN

    Performing a full database disaster recovery with RMAN1. Make the RMAN backup set pieces available.2 ...

  8. 云区域(region),可用区(AZ),跨区域数据复制(Cross-region replication)与灾备(Disaster Recovery)(部分1)

    本文分两部分:部分1 和 部分2.部分1 介绍 AWS,部分2 介绍阿里云和OpenStack云. 1. AWS 1.1 AWS 地理组件概况 AWS 提供三种地理性组件: Regions:区域,即A ...

  9. High Availability (HA) 和 Disaster Recovery (DR) 的区别

    High availability 和disaster recovery不是一回事. 尽管在规划和解决方案上有重叠的部分, 它们俩都是business contiunity的子集. HA的目的是在主数 ...

随机推荐

  1. libpcap 库使用(二)

    参考资料: http://www.tcpdump.org/manpages/pcap.3pcap.html 分类介绍了该lib的函数 Opening a capture handle for read ...

  2. Spring IOC(八)bean 的创建

    Spring IOC(八)bean 的创建 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) 参考: 每天用心记录一点点.内 ...

  3. c++11 stl 学习之 shared_ptr

    shared_ptr智能指针 shared_ptr 的声明初始化方式由于指针指针使用explicit参数 必须显示声明初始化shared_ptr<string> pNico = new s ...

  4. 跟我学Spring Boot(二)Hello World

    1.打开DemoApplication添加如下代码 package com.example; import org.springframework.boot.SpringApplication; im ...

  5. javascript 事件流的应用之 addEventListener

    原始需求:防止按钮短时间内高频率触发点击事件,由于重复提交导致的业务异常. 图: demo: <!DOCTYPE html> <html lang="en" di ...

  6. GOIP connects with Elastix through “config by line”

    GOIP connects with Elastix through “config by line” By grace Liu on May 17, 2013 in Elastix, Gateway ...

  7. 基于Web Service的客户端框架搭建一:C#使用Http Post方式传递Json数据字符串调用Web Service

    引言 前段时间一直在做一个ERP系统,随着系统功能的完善,客户端(CS模式)变得越来越臃肿.现在想将业务逻辑层以下部分和界面层分离,使用Web Service来做.由于C#中通过直接添加引用的方来调用 ...

  8. ServiceDesk Plus更有序地组织IT项目

  9. python之并发编程进阶篇9

    一.守护进程和守护线程 1)守护进程的概念 什么是守护进程: 守护: 在主进程代码结束情况下,就立即死掉 守护进程本质就是一个子进程,该子进程守护着主进程 为何要用守护进程 守护进程本质就是一个子进程 ...

  10. Windows下python环境配置

    步骤: 1.安装Python.Sublime Text: 2.打开Sublime Text,在菜单栏点击“Tools”->“Build System”->“New Build System ...