http://ac.jobdu.com/problem.php?pid=1013
来源:互联网 发布:查士丁尼瘟疫 知乎 编辑:程序博客网 时间:2024/05/01 09:53
- 题目描述:
- 每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。现有一堆杂乱的机房签到、签离记录,请根据记录找出当天开门和关门的人。
- 输入:
测试输入的第一行给出记录的总天数N ( N> 0 ),下面列出了N天的记录。
每天的记录在第一行给出记录的条目数M (M > 0 ),下面是M行,每行的格式为
证件号码 签到时间 签离时间
其中时间按“小时:分钟:秒钟”(各占2位)给出,证件号码是长度不超过15的字符串。
- 输出:
对每一天的记录输出1行,即当天开门和关门人的证件号码,中间用1空格分隔。
注意:在裁判的标准测试输入中,所有记录保证完整,每个人的签到时间在签离时间之前,且没有多人同时签到或者签离的情况。
- 样例输入:
31ME3021112225321 00:00:00 23:59:592EE301218 08:05:35 20:56:35MA301134 12:35:45 21:40:423CS301111 15:30:28 17:00:10SC3021234 08:00:00 11:25:25CS301133 21:45:00 21:58:40
- 样例输出:
ME3021112225321 ME3021112225321EE301218 MA301134SC3021234 CS301133
- #include<iostream>
- #include<cstdio>
- #include<memory.h>
- #include<cstdlib>
- using namespace std;
- struct Node{
- char str[16];
- int h, m, s;
- bool operator <(const Node &b)const{
- if(h!=b.h)
- return h<b.h;
- if(m!=b.m)
- return m<b.m;
- return s<b.s;
- }
- bool operator >(const Node &b)const{
- if(h!=b.h)
- return h>b.h;
- if(m!=b.m)
- return m>b.m;
- return s>b.s;
- }
- };
- Node nodes[2];
- int main(){
- //freopen("in.txt", "r", stdin);
- int n, m;
- char s[20];
- while(cin>>n){
- for(int i=0;i<n;++i){
- cin>>m;
- nodes[0].h = 1000;
- nodes[1].h = -1000;
- while(m--){
- Node node;
- cin>>node.str;
- cin>>node.h;
- getchar();
- cin>>node.m;
- getchar();
- cin>>node.s;
- if(node<nodes[0])
- nodes[0] = node;
- cin>>node.h;
- getchar();
- cin>>node.m;
- getchar();
- cin>>node.s;
- if(node>nodes[1])
- nodes[1] = node;
- }
- cout<<nodes[0].str<<" "<<nodes[1].str<<endl;
- }
- }
- //fclose(stdin);
- return 0;
- }
- http://ac.jobdu.com/problem.php?pid=1013
- http://ac.jobdu.com/problem.php?pid=1008
- http://ac.jobdu.com/problem.php?pid=1009
- http://ac.jobdu.com/problem.php?pid=1007
- http://ac.jobdu.com/problem.php?pid=1033
- http://ac.jobdu.com/problem.php?pid=1005
- http://ac.jobdu.com/problem.php?pid=1006
- http://ac.jobdu.com/problem.php?pid=1003
- http://ac.jobdu.com/problem.php?pid=1035
- http://ac.jobdu.com/problem.php?pid=1032
- http://ac.jobdu.com/problem.php?pid=1030
- http://ac.jobdu.com/problem.php?pid=1029
- http://ac.jobdu.com/problem.php?pid=1028
- http://ac.jobdu.com/problem.php?pid=1027
- http://ac.jobdu.com/problem.php?pid=1026
- http://ac.jobdu.com/problem.php?pid=1025
- http://ac.jobdu.com/problem.php?pid=1024
- http://ac.jobdu.com/problem.php?pid=1023
- http://ac.jobdu.com/problem.php?pid=1019
- http://ac.jobdu.com/problem.php?pid=1017
- http://ac.jobdu.com/problem.php?pid=1016
- http://ac.jobdu.com/problem.php?pid=1014
- Round #145(Div 2)
- http://ac.jobdu.com/problem.php?pid=1013
- http://ac.jobdu.com/problem.php?pid=1012
- http://ac.jobdu.com/problem.php?pid=1011
- http://ac.jobdu.com/problem.php?pid=1010
- 餐饮经营思考(一)——利润&成本
- Problem 1607 Greedy division from http://acm.fzu.edu.cn/problem.php?pid=1607
- Problem 1582 众数问题 from http://acm.fzu.edu.cn/problem.php?pid=1582
- Problem 1478 环形整数串 from http://acm.fzu.edu.cn/problem.php?pid=1478
- Visual CertExam Suite v3 0 1 Cracked-BLiZZARD