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:
#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;
}
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甲级 1006.Sign In and Sign Out(25) 题目翻译与答案
- [PAT甲级]1006. Sign In and Sign Out (25)(找出机房开门锁门的人)
- 1006. Sign In and Sign Out (25) PAT 甲级
- PAT甲级 1006. Sign In and Sign Out (25)
- PAT 甲级 1006. Sign In and Sign Out (25)
- 1006. Sign In and Sign Out (25) PAT甲级刷题
- PAT 甲级 1006. Sign In and Sign Out
- PAT - 甲级 - 1006. Sign In and Sign Out (25
- PAT(甲级)1006. Sign In and Sign Out (25)
- PAT(甲级)1006. Sign In and Sign Out
- PAT TEST甲级1006. Sign In and Sign Out (25)
- 【PAT甲级】【C++】1006. Sign In and Sign Out (25)
- PAT甲级1006. Sign In and Sign Out
- 【PAT甲级】1006. Sign In and Sign Out (25)
- PAT程序设计考题——甲级1006(Sign In and Sign Out ) C++实现
- PAT甲级1006. Sign In and Sign Out (25)
- [PAT-甲级]1006.Sign In and Sign Out
- 【PAT甲级】1006 Sign In and Sign Out(25)——JAVA实现
- PAT甲级真题及训练集(8)--1006. Sign In and Sign Out (25)
- 浙江大学PAT_甲级_1006. Sign In and Sign Out (25)