您的位置:首页 > 其它

PAT 甲级 1006. Sign In and Sign Out

2018-02-13 18:55 399 查看
测试用例
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 <stdio.h>
#include "iomanip"
#include "vector"
#include "cmath"
#include "stack"
#include "algorithm"
#include <math.h>
#include "map"
#include "queue"
using namespace std;

int main()
{

int n,h,m,s;
int in=777777777,out=0;
string name,iname,oname;
cin>>n;
while(n--)
{
cin>>name;
scanf("%d:%d:%d",&h,&m,&s);
int t=s+m*60+h*3600;
if(in>t)
{
iname=name;
in=t;
}
scanf("%d:%d:%d",&h,&m,&s);
t=s+m*60+h*3600;
if(out<t)
{
oname=name;
out=t;
}
}

cout<<iname<<" "<<oname;

return 0;

}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  PAT