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 <string> using namespace std; //很简单,就是找到来的最早的人和回去最晚的人即可
int getTime(string Time)
{
//由于时间时标准输入,所以很好计算
return ((Time[] - '') * + (Time[] - '')) * * +
((Time[] - '') * + (Time[] - '')) * +
(Time[] - '') * + (Time[] - ''); } int main()
{
int M;
cin >> M;
string firstMan, lastMan;
int firstTime, lastTime;
firstTime = * * + ;//24小时多一秒,属于第二天了
lastTime = -;//属于前一天
string No, InTime, OutTime;
for (int i = ; i < M; ++i)
{
cin >> No >> InTime >> OutTime;
if (firstTime > getTime(InTime))
{
firstTime = getTime(InTime);
firstMan = No;
}
if (lastTime < getTime(OutTime))
{
lastTime = getTime(OutTime);
lastMan = No;
}
}
cout << firstMan << " " << lastMan << endl;
return ;
}
 

PAT甲级——A1006 Sign In and Sign Out的更多相关文章

  1. 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 ...

  2. PAT甲级——1006 Sign In and Sign Out

    PATA1006 Sign In and Sign Out At the beginning of every day, the first person who signs in the compu ...

  3. 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 ...

  4. PAT Sign In and Sign Out[非常简单]

    1006 Sign In and Sign Out (25)(25 分) At the beginning of every day, the first person who signs in th ...

  5. 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 ...

  6. 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 ...

  7. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  8. PAT 甲级真题题解(1-62)

    准备每天刷两题PAT真题.(一句话题解) 1001 A+B Format  模拟输出,注意格式 #include <cstdio> #include <cstring> #in ...

  9. 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 ...

随机推荐

  1. Java中哪个JSON库的解析速度是最快的?

    JSON已经成为当前服务器与WEB应用之间数据传输的公认标准,不过正如许多我们所习以为常的事情一样,你会觉得这是理所当然的便不再深入思考 了.我们很少会去想用到的这些JSON库到底有什么不同,但事实上 ...

  2. 关于soapui如何做安全测试

    1.首先安装soapui5.1.2 第一步:运行SoapUI-Pro-x32-5.1.2_576024.exe文件,按照步骤安装成功: 第二步:拷贝Protection-4.6.jar到soapui安 ...

  3. [JZOJ4330] 【清华集训模拟】几何题

    题目 题目大意 也懒得解释题目大意了-- 正解 正解居然是\(FFT\)? 不要看题目的那个式子这么长,也不要在那个式子上下手. 其实我们会发现,不同的\((x_i-x_j,y_i-y_j,z_i-z ...

  4. Scala 方法与函数简单记录

    /** * Scala 方法与函数 * Scala 有方法与函数,二者在语义上的区别很小.Scala 方法是类的一部分,而函数是一个对象可以赋值给一个变量.换句话来说在类中定义的函数即是方法 */ o ...

  5. 区别 |峰度(Kurtosis)和偏度(Skewness)

      峰度(Kurtosis) 定义 峰度又称峰态系数,表征概率密度分布曲线在平均值处峰值高低的特征数,即是描述总体中所有取值分布形态陡缓程度的统计量.直观看来,峰度反映了峰部的尖度.这个统计量需要与正 ...

  6. 登录操作(方法一:设置flag标志位)

    登录操作(方法一:设置flag标志位) user_name="star"passwoed='123'passed_authentication=Falsecount=0for i ...

  7. Date()日期转换和简单计算

    /** * 判断是否为闰年 * @param year * @return */ public boolean isLeap ( int year ) { if ( (year % 4 == 0 &a ...

  8. 将Form的AlphaBlend属性设置为True,之后调整Form的AlphaBlendValue属性,255为不透明,数字越小透明度越大~~~想显示文字用l

    将Form的AlphaBlend属性设置为True,之后调整Form的AlphaBlendValue属性,255为不透明,数字越小透明度越大~~~想显示文字用lable就行哈~~~直接在窗体上写字就行 ...

  9. Spring基础面试题(一)

    Spring是什么? Spring是一个轻量级的IoC和AOP容器框架.是为Java应用程序提供基础性服务的一套框架,目的是用于简化企业应用程序的开发,它使得开发者只需要关心业务需求.常见的配置方式有 ...

  10. selenium python bindings 写测试用例

    这章总结selenium在UI测试方面的用法 import unittest from selenium import webdriver from selenium.webdriver.common ...