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 分)思路:普通的时间比较题。。。的更多相关文章

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

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

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

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

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

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

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

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

随机推荐

  1. js Worker 线程

    在平时的运行的javascript脚本都在主线程中执行,如果当前脚本包含复杂的.耗时的代码.那么JavaScript脚本的执行将会被阻塞,甚至整个刘看齐都是提示失去响应. 例子: 假设程序需要计算.收 ...

  2. Java基础学习-内部类

    /*内部类: 成员内部类 局部内部类 匿名内部类*/ package insideclass; /*成员内部类: * 在类的成员位置,和成员变量,成员方法的位置是一样的. * 内部类可以直接访问为外部 ...

  3. spring boot 教程(一) 构建我的第一个Spring boot

    Spring Boot特点 1. 创建独立的Spring应用程序 2. 嵌入的Tomcat,无需部署WAR文件 3. 简化Maven配置 4. 自动配置Spring 5. 提供生产就绪型功能,如指标, ...

  4. Java 代码规范,你应该知道的一些工具和用法

    从事编程这个行业,你一定被别人说过或者说过别人这句话:代码要规范!求职面试时也能从 JD 上看到这个要求:要有良好的编程习惯.其实都是在讲代码规范(Code Style)这件事情. 每个人都有自己的编 ...

  5. 怎么样编译DeepMind?

    可以通过下面的文章来编译著名的deepmind系统. How to build DeepMind LabDeepMind Lab uses Bazel as its build system. Its ...

  6. 利用pandas随机切分csv文件

    把数据集随机切分为训练集和测试集 method 1: df = pd.read_csv('data/tgnb_merge.csv', encoding='utf-8') df.drop_duplica ...

  7. 上周面试回来后写的Java面试总结,想进BAT必看

    上周陪同之前一起工作的同事去面试(乔治,小袁,鹏飞(面试人)),第一站是去深圳,第二站上海,第三站杭州.面试什么公司我在这里就不多说了,你们知道是一线公司就行.其实本来真的没打算写这篇文章,主要是自己 ...

  8. Sublime 笔记

    1. 安装PackageControl 官网:https://packagecontrol.io/ v2: import urllib2,os,hashlib; h = '2915d1851351e5 ...

  9. 【备份】 解决acer v5 471g arch关机后自动重启的问题

    Fedora 17 on an Aspire V5-571 -- Reboot on Shutdown13 FEBRUARY 2015Update on 2/13/15: This article w ...

  10. 数位DP新识

    简单题:HDU2089    HDU3652  HDU4734   HDU3555  POJ3252  HigoCoder1033(需要前导0,或者用方法4) 总结: 1,dfs(pos,state, ...