B - Avoiding a disaster
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的更多相关文章
- HDU 4177 模拟时间问题
Avoiding a disaster Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- 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, ...
- 读Avoiding the Disk Bottleneck in the Data Domain Deduplication File System
最近在思考和实践怎样应用重复数据删除技术到云存储服务中.找了些论文来读,其中<Avoiding the Disk Bottleneck in the Data Domain Deduplicat ...
- Disaster Recovery, High Availability, and Continuous Availability - What's the Difference?
Disaster Recovery, High Availability, and Continuous Availability - What's the Difference? Posted by ...
- 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 ...
- PLSQL_性能优化工具系列16_Best Practices: Proactively Avoiding Database
占位符 PLSQL_性能优化工具系列_Best Practices: Proactively Avoiding Database/Query Performance Issue
- Performing a full database disaster recovery with RMAN
Performing a full database disaster recovery with RMAN1. Make the RMAN backup set pieces available.2 ...
- 云区域(region),可用区(AZ),跨区域数据复制(Cross-region replication)与灾备(Disaster Recovery)(部分1)
本文分两部分:部分1 和 部分2.部分1 介绍 AWS,部分2 介绍阿里云和OpenStack云. 1. AWS 1.1 AWS 地理组件概况 AWS 提供三种地理性组件: Regions:区域,即A ...
- High Availability (HA) 和 Disaster Recovery (DR) 的区别
High availability 和disaster recovery不是一回事. 尽管在规划和解决方案上有重叠的部分, 它们俩都是business contiunity的子集. HA的目的是在主数 ...
随机推荐
- CODE[VS]4228 小猫爬山 小猫爬山
原题链接 第一眼还以为是贪心,然后随便找了几组例子瞬间推翻贪心的想法.发现\(n\leqslant18\),显然是用爆搜+剪枝. 爆搜主体我是对小猫进行枚举,判断增添缆车,其实这是一个比较慢的搜法,而 ...
- Intellij IDEA 快捷键整理-鬼畜版(全键盘开发指南)
一 .何为鬼畜? 鬼畜一词在ACG爱好者中也代指通过影片(或音讯)剪辑,用频率极高的重复画面(或声音)组合而成的一段节奏配合音画同步率极高的一类影片,而这类鬼畜影片多见于NICONICO.AcFun和 ...
- 谁说delphi没有IOCP库,delphi新的IOCP类库,开源中
DIOCP Demo说明 下载地址 https://code.google.com/p/diocp/ 特地为DIOCP开设了一个群:320641073,欢迎学习的IOCP的童鞋进入讨论. 核心作者: ...
- 如何使用AE来制作烟雾粒子特效
1. 首先,我们先建立一个合成,大小1280×720,帧速率25,持续时间为10秒,建好后,再新建一个固态层点击确定. 2.点击效果添加Particular粒子插件 3. 点开粒子插件的发射器,方 ...
- freemarker【FTL】常见语法大全
FreeMarker的插值有如下两种类型:1,通用插值${expr};2,数字格式化插值:#{expr}或#{expr;format} ${book.name?if_exists } //用于判断如果 ...
- activiti5.22整合modeler时出错TypeError: Cannot read property 'split' of undefined
activiti5.22.0整合modeler时,打开的流程页面不显示工具栏和左边的控件栏,产生如下的错误: TypeError: Cannot read property 'split' of un ...
- DB2 sql报错后查证原因与解决问题的方法
1.对于执行中的报错,可以在db2命令行下运行命令 : db2=>? SQLxxx 查看对应的报错原因及解决方法. 2.错误SQL0206N SQLSTATE=42703 检测到一个未定义的列 ...
- mysql.lib 的使用
一 说明 mysql.lib 提供了很多方便的操作,同时结合 vector 使用十分方便. 二 使用 1 声明需要用到的变量 static MYSQL s_mysql[DATABASE ...
- 用windows计划任务执行一些内容的写法,
用windows计划任务执行一些内容的写法, 以下示例: 1.创建ws对象 2.关闭java进程 3.执行bat文件 start.vbe文件内容 set ws=wscript.createobject ...
- JWT-Token登陆校验
JWT:就是靠给客户端(浏览器)一个规范凭证(签名),然后服务器解析签名,代替原有的session存值. 不带refreshToken的JWT例子:https://blog.csdn.net/u011 ...