1006 Sign In and Sign Out (25)(25 分)思路:普通的时间比较题。。。
1006 Sign In and Sign Out (25)(25 分)
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked and locked the door on that day.
Input Specification:
Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:
ID_number Sign_in_time Sign_out_time
where times are given in the format HH:MM:SS, and ID number is a string with no more than 15 characters.
Output Specification:
For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.
Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.
Sample Input:
3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40
Sample Output:
SC3021234 CS301133
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
#include<vector>
#include<stack>
#define inf 0x3f3f3f3f
using namespace std;
int compare(int x,int y,int z,int a,int b,int c)
{
if(x==a)
{
if(y==b)
{
if(z>=c)
return ;
else return ;
}
else if(y>b)
return ;
else return ;
}
else if(x>a)
return ;
else
return ;
} int main()
{
int n;
while(cin>>n)
{
string mi,ma;
int ai=,bi=,ci=;
int aa=,ba=,ca=;
for(int i=;i<=n;i++)
{
string s;
cin>>s;
int a,b,c;
scanf("%d:%d:%d",&a,&b,&c);
if(compare(ai,bi,ci,a,b,c)==)
{
mi=s;
ai=a;
bi=b;
ci=c;
}
scanf("%d:%d:%d",&a,&b,&c);
if(compare(aa,ba,ca,a,b,c)==)
{
ma=s;
aa=a;
ba=b;
ca=c;
}
}
cout<<mi<<" "<<ma;
}
return ;
}
1006 Sign In and Sign Out (25)(25 分)思路:普通的时间比较题。。。的更多相关文章
- PAT 甲级 1006 Sign In and Sign Out (25)(25 分)
1006 Sign In and Sign Out (25)(25 分) At the beginning of every day, the first person who signs in th ...
- 1006 Sign In and Sign Out (25 分)
1006 Sign In and Sign Out (25 分) At the beginning of every day, the first person who signs in the co ...
- PAT甲 1006. Sign In and Sign Out (25) 2016-09-09 22:55 43人阅读 评论(0) 收藏
1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
- pat 1006 Sign In and Sign Out(25 分)
1006 Sign In and Sign Out(25 分) At the beginning of every day, the first person who signs in the com ...
- PAT (Advanced Level) Practice 1006 Sign In and Sign Out (25 分) 凌宸1642
PAT (Advanced Level) Practice 1006 Sign In and Sign Out (25 分) 凌宸1642 题目描述: At the beginning of ever ...
- 1006. Sign In and Sign Out (25)
At the beginning of every day, the first person who signs in the computer room will unlock the door, ...
- pat 1006 Sign In and Sign Out (25)
At the beginning of every day, the first person who signs in the computer room will unlock the door, ...
- 1006 Sign In and Sign Out (25)(25 point(s))
problem At the beginning of every day, the first person who signs in the computer room will unlock t ...
- 1006.Sign in and Sign out(25)—PAT 甲级
At the beginning of every day, the first person who signs in the computer room will unlock the door, ...
随机推荐
- L165
New evidence of how the Norse became long-distance marinersAccording to the saga of Erik the Red, “s ...
- HTML, CSS. JS的各种奇葩bug
1. block包含inline-block的时候, inline-block 没有内容的时候,会根据 font 产生一个 line-height 来产生一个空白块. 解决方法: <div cl ...
- 测试实战经验之checklist篇20140905
我们测试中,在各个环节应该有自己的一个checklis来帮助我们梳理我们要做什么,该做什么,以下是我的一个小总结: 1.在测试前我们需要做的: 2.在拿到测试包后我们该做的 3.测试通过后我们该做的 ...
- keras 报错 ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("embedding_1/random_uniform:0", shape=(5001, 128), dtype=float32)'
在服务器上训练并保存模型,复制到本地之后load_model()报错: ValueError: Tensor conversion requested dtype int32 for Tensor w ...
- IOS开发 多线程编程 - NSOperationQueue
一.简介 一个NSOperation对象可以通过调用start方法来执行任务,默认是同步执行的.也可以将NSOperation添加到一个NSOperationQueue(操作队列)中去执行,而且是异步 ...
- 微信小程序视频教程
微信小程序全套视频教程在线观看地址:http://v.qq.com/vplus/92e0ff1abe80fce5bcfe344f11a106c5/foldervideos/hod000101p9le1 ...
- vue项目更改端口号
vue项目的默认端口为8080,有时候处于某些原因会造成端口号的冲突,因此需要我们适当的更改其端口号来解决问题,将上图中的port更改为合适的端口号就可以,但是需要注意的是浏览器的安全限制端口号详情见 ...
- Git详解之四 服务器上的Git
以下内容转载自:http://www.open-open.com/lib/view/open1328069988843.html 服务器上的 Git 到目前为止,你应该已经学会了使用 Git 来完成日 ...
- getServletContext()方法详解
javax.servlet.ServletContext接口 一个servlet上下文是servlet引擎提供用来服务于Web应用的接口.Servlet上下文具有名字(它属于Web应用的名字)唯一映射 ...
- 一些Fibonacci数列的神奇性质【数学】
递推式: \(f_i=1 (1\leq i\leq 2)\) \(f_i=f_{i-1}+f_{i-2}(i>2)\) 一些性质 \(\sum_{i=1}^n f_i=f_{n+2}-1\) \ ...