1006. Sign In and Sign Out (25)

时间限制
400 ms

内存限制
65536 kB

代码长度限制
16000 B

判题程序
Standard

作者
CHEN, Yue

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<stdio.h>
struct{char a[16];int in,out;
}id[1000000];
int main(){int m;scanf("%d",&m);int i,in1,in2,in3,out1,out2,out3;for(i=0;i<m;i++){scanf("%s %d:%d:%d %d:%d:%d",id[i].a,&in1,&in2,&in3,&out1,&out2,&out3);id[i].in=in1*10000+in2*100+in3;id[i].out=out1*10000+out2*100+out3;}int small,big,si=0,bi=0;small=id[0].in;big=id[0].out;for(i=1;i<m;i++){if(id[i].in<small){small=id[i].in;si=i;}if(id[i].out>big){big=id[i].out;bi=i;}            }printf("%s %s",id[si].a,id[bi].a);return 0;
} 

浙大PAT甲级1006相关推荐

  1. PAT甲级1006 Sign In and Sign Out:[C++题解]字符串处理

    文章目录 题目分析 题目链接 题目分析 读入三个字符串. 需要记录最早开门的人的id和时间,最晚离开的人的id和时间. 本题的简单之处在于 时间的位数都相同,比如 10点和01点.因此这样的时间大小比 ...

  2. 浙大PAT甲级1040

    浙大PAT甲级1040 原题 问题分析 原题 1040 Longest Symmetric String (25 分) Given a string, you are supposed to outp ...

  3. 浙大PAT甲级1019. General Palindromic Number (20)

    1019. General Palindromic Number (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...

  4. 【PAT - 甲级1006】Sign In and Sign Out (25分)(STLmap)

    题干: At the beginning of every day, the first person who signs in the computer room will unlock the d ...

  5. 浙大PAT甲级1027. Colors in Mars (20)

    1027. Colors in Mars (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue People ...

  6. 浙大 PAT 甲级1009

    1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...

  7. 浙大PAT甲级-1017

    银行队列: (却没用到队列) #include <iostream> #include <string> #include <algorithm> #include ...

  8. 浙大PAT甲级-1021

    还是看了凌大佬的博客才全部ac的 (https://blog.csdn.net/iaccepted/article/details/20454519) #include <iostream> ...

  9. PAT甲级题目解析和知识点分类整理

    转载请注明出处 个人博客:https://maxusun.github.io/ 今天整理电脑,发现了去年为了考研浙大计算机整理的PAT资料.现在考研已经尘埃落定.想到当时盲目刷题浪费了好多时间,在这里 ...

最新文章

  1. 使用 Inception-v3,实现图像识别(Python、C++)
  2. 自媒体人怎样快速拥有自己的APP
  3. Streams全库复制
  4. 超级计算机发展及现状论文,浅谈超级计算机发展的过程及研究现状
  5. 蓝桥杯51单片机之利用中断同时控制流水灯、数码管、独立按键、蜂鸣器【单片机开发初学者有趣综合案例】
  6. .net session 有效时间_【面试题】|干货!.NET C# 简答题Part 07
  7. linux vim golang 插件,golang vim 插件设置
  8. svn版本回退(CornerStone)
  9. 大数据工程专业技术证书考试-数据分析与应用
  10. 弗拉基米尔·多罗宁_罗紫琳新欢俄亿万富豪 女星与老外的那些事儿
  11. 论文DepthTrack: Unveiling the Power of RGBD Tracking阅读及代码讲解
  12. MOOS-ivp 实验九 分布式旅行商问题(1)
  13. 深度学习(3):不同分类模型的评价指标(F1、Recall、P)
  14. C语言编程编程思维培养的重要性,谈编程思维的培养
  15. 武汉市申请国家现代农业产业科技创新中心发展奖励标准及申请要求
  16. 要想富,先有LU,超能鹿战队LU开盘涨幅240%
  17. AndroidStudio的数据存储(SharedPreferences存储)
  18. 多个联盟广告调用代码,这样做可以做到打开页面,随机显示一个联盟广告代码
  19. opnecascade 与parasolid和ACIS 比较 优缺点。opnecascade源代码发我
  20. 【3月8日特训】经验总结

热门文章

  1. 去中心化保险协议InsurAce完成100万美元种子轮融资,DeFiance Capital领投
  2. SAP License:SAP职场处好人际关系的六大秘籍
  3. SAP License:SAP中的凭证查询、科目余额表及分类账详解
  4. pl/sql实现打印九九乘法表
  5. Android应用程序内部启动Activity过程(startActivity)的源代码分析
  6. 【git】搭建git服务器
  7. 【BZOJ】2289: 【POJ Challenge】圆,圆,圆
  8. 【原创】轻量级移动设备即时通讯技术MobileIMSDK的常见问题解答
  9. 45度地图遮挡问题解决方案(cocos2d-x)
  10. DataGridView下拉框动态赋值以及事件处理