当前位置:网站首页>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;
}
边栏推荐
- Envi SHP to ROI and mask the grid
- 自定义类型:枚举
- Summary of ROS master-slave communication experience
- Jing Wei PS tutorial: basic part a
- ZCMU--5083: ly的数对(C语言)
- [leetcode] skillfully use bit operation
- File browser? QT can also be achieved!
- SS-Paper【1】:Fully Convolutional Networks for Semantic Segmentation
- Topic 6 - message queue for client communication
- AMD锐龙7000预计9月15日上市 3D缓存版还要再等等
猜你喜欢

JSP custom tag library --foreach

Jing Wei PS tutorial: basic part a

QT embed Notepad under win10

Mysql增删改查、检索与约束(详细教学)

Rare earth Developer Conference | Apache pulsar committee Liu Dezhi shares the way of cloud native technology transformation

Meeting OA project progress (I)

IP第十三天笔记

mysql 查询某字段中以逗号分隔的字符串的方法

期盼已久全平台支持-开源IM项目OpenIM之uniapp更新

Sword finger offer 22. the penultimate node in the linked list
随机推荐
Implementation of side list menu (side menu) of wechat applet
[machine learning basics] - another perspective to explain SVM
The third edition of New Horizon College English reading and Writing Tutorial 4 graduation examination site (units 1,2,3,5,6)
Is it safe for Mr. qiniu to open a securities account? Can I drive it?
[leetcode] skillfully use bit operation
Envi grid resampling
QT design robot simulation controller -- key control robot joint rotation
What is fuzzy theory, foundation and process
随笔记:同步、异步和微任务、宏任务的打印顺序
The differences of several deletions in SQL
MODIS data WGet Download
Envi SHP to ROI and mask the grid
Sword finger offer 48. the longest substring without repeated characters
quick get start
剑指 Offer 22. 链表中倒数第k个节点
[technology] chat room demo of uniapp
Why should we launch getaverse?
Cann training camp learns the animation stylization and AOE ATC tuning of the second season of 2022 model series
会议OA项目进度(二)
JS, call in the for loop is asynchronously converted to synchronous execution