当前位置:网站首页>PAT甲级——签到与签出
PAT甲级——签到与签出
2022-07-24 17:01:00 【战士小小白】
签到与签出
每天第一个到机房的人负责开门,最后一个从机房离开的人负责锁门。
现在,给定每个人的签到与签出记录,请你找出当天开门的人以及锁门的人分别是谁。
输入格式
第一行包含整数 MM,表示共有 MM 个人的签到签出记录。
接下来 MM 行,每行的形式如下:
ID_number Sign_in_time Sign_out_time
时间以 HH:MM:SS 形式给出,ID_number 是一个长度不超过 1515 的字符串。
输出格式
共一行,输出开门人和锁门人的ID_number,用一个空格隔开。
数据范围
1≤M≤101≤M≤10,
数据保证每个人的签到时间早于签出时间,并且不会出现两个人同时签到或同时签出的情况。
输入样例:
3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40
输出样例:
SC3021234 CS301133
#include <bits/stdc++.h>
using namespace std;
int main()
{
string op_id, op_time;
string cl_id, cl_time;
int n;
cin >> n;
for(int i = 0; i < n; i ++)
{
string id, in_time, out_time;
cin >> id >> in_time >> out_time;
if(!i || in_time < op_time)
{
op_id = id;
op_time = in_time;
}
if(!i || out_time > cl_time)
{
cl_id = id;
cl_time = out_time;
}
}
cout << op_id << " " << cl_id << endl;
return 0;
}
边栏推荐
- Apachecon Asia 2022 opens registration: pulsar technology issues make a big debut
- Solve the timeliness problem caused by Eureka's default cache configuration
- Picture browser? QT can also be achieved!
- QT QML virtual keyboard
- Development dynamics | stonedb 2022 release milestone
- ZCMU--5023: 家庭划分(C语言)
- Envi5.3 open GF-1 WFV data
- Implementation of side list menu (side menu) of wechat applet
- Custom types: Enumeration
- Internet Download Manager配置
猜你喜欢
随机推荐
AXI协议(1):AMBA总线介绍,AXI概念与背景介绍,AXI协议特点与功能
15. ARM embedded system: how to debug single board with PC
QT keyboard event (II) -- long press the key to trigger the event event repeatedly, and the problem is solved
Meeting OA project progress (I)
我们为什么要推出Getaverse?
安全的证券公司有哪些?我想在手机上买股票
Causes and solutions of QT signal and slot connection failure
快速入门
JUC source code learning note 3 - AQS waiting queue and cyclicbarrier, BlockingQueue
MySQL basic commands
荣耀CEO赵明:单一厂商很难实现全场景产品覆盖
[数组]NC143 矩阵乘法-简单
Buffer overflow vulnerability lab experiment record
Live review | wonderful playback of Apache pulsar meetup (including PPT download)
Code random notes_ Linked list_ 707 design linked list
ShardingSphere数据库读写分离
自定义类型:枚举
代码随想录笔记_链表_707设计链表
With notes: printing order of synchronous, asynchronous, micro task and macro task
Custom types: Enumeration








