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, ...
随机推荐
- js Worker 线程
在平时的运行的javascript脚本都在主线程中执行,如果当前脚本包含复杂的.耗时的代码.那么JavaScript脚本的执行将会被阻塞,甚至整个刘看齐都是提示失去响应. 例子: 假设程序需要计算.收 ...
- windows 下git 的配置安装与使用
一.安装GIT(过于简单略过) 二.配置git 二(一).配置git的user name和email 打开 git bash,输入 $ git config --global user.name &q ...
- SpringInAction--Spring Web应用之SpringMvc 注解配置
Spring MVC 是当前Web服务器中常用的结构,今天就来学习这相关的知识,首先上图——Spring请求的时候所经历的坎坷之路: (书上原话,算是解释..) 在请求离开浏览器时① ,会带有用户所请 ...
- Python基础学习----元组
# 元组和列表的区别: # 相同点: # 1.表示多个元素的序列 # 2.数据之间用 , 分开 # 3.索引都是[0]开始 # # 不同点: # 1.列表创建是[],元组是()表示 # 2.元组元素一 ...
- 手机微信网站开发放弃windows phone的理由
1.手机操作系统市场份额: 全球(2.44% 下滑): http://news.mydrivers.com/1/449/449736.htm 中国(1% 下滑): http://app.techweb ...
- TypeError: pivot_table() got an unexpected keyword argument 'rows'
利用Python进行数据分析>第二章,处理MovieLens 1M数据集,有句代码总是报错: mean_rating = data.pivot_table('rating', rows='tit ...
- 机器学习算法实现解析——libFM之libFM的训练过程之Adaptive Regularization
本节主要介绍的是libFM源码分析的第五部分之二--libFM的训练过程之Adaptive Regularization的方法. 5.3.Adaptive Regularization的训练方法 5. ...
- 圣诞节为大家推荐一些学习java书籍
怎样学习才能从一名Java初级程序员成长为一名合格的架构师,或者说一名合格的架构师应该有怎样的技术知识体系,这是不仅一个刚刚踏入职场的初级程序员也是工作一两年之后开始迷茫的程序员经常会问到的问题 初级 ...
- windows之死活格式化不了D/E/F盘
唉 见教程:Win10系统无法格式化电脑D盘的解决方法
- sersync2 文件的实时同步备份
|——需求: 监控192.168.9.5[主] 下的 /data/vmeipai 目录 --> 同步到 192.168.12.8 [备] 下的 /data/vmeipai 目录 |——网络拓 ...