当前位置:网站首页>Pat class A - check in and check out
Pat class A - check in and check out
2022-07-24 17:04:00 【Soldier Xiaobai】
Check in and check out
The first person to the computer room is responsible for opening the door every day , The last person to leave the machine room is responsible for locking the door .
Now? , Give everyone's check-in and check-out records , Please find out who opened the door that day and who locked the door .
Input format
The first line contains integers MM, Expressing common ownership MM Personal check-in and check-out records .
Next MM That's ok , The form of each line is as follows :
ID_number Sign_in_time Sign_out_time
Time to HH:MM:SS Form gives ,ID_number Is a length not more than 1515 String .
Output format
All in one line , Output the of the door opener and the door locker ID_number, Separated by a space .
Data range
1≤M≤101≤M≤10,
The data ensures that everyone's check-in time is earlier than the check-out time , And there will be no two people signing in or checking out at the same time .
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 <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;
}
边栏推荐
- 安全的证券公司有哪些?我想在手机上买股票
- 双亲委派机制
- Still developing games with unity? Then you're out. Try unity to build an answer system
- QT embed Notepad under win10
- Digital transformation must have digital thinking
- Jupyter uses tips
- PAT甲级——拼写正确
- mysql 查询某字段中以逗号分隔的字符串的方法
- Parental delegation mechanism
- MySQL addition, deletion, modification, retrieval and constraint (detailed teaching)
猜你喜欢

At & T pseudo instruction and interpretation of CFI CFA

Why should we launch getaverse?

Cann training camp learns the animation stylization and AOE ATC tuning of the second season of 2022 model series

Topic 6 - message queue for client communication

Logisim group experiment 10 single cycle MIPS CPU

Exception handling - a small case that takes you to solve NullPointerException

Apachecon Asia 2022 opens registration: pulsar technology issues make a big debut

Template method mode
![为什么被调函数内部不能用 sizeof(arr) / size(arr[0]) 计算数组长度?](/img/e6/1d2213f3eb9bd0ff537a66d2b01f98.png)
为什么被调函数内部不能用 sizeof(arr) / size(arr[0]) 计算数组长度?

JSP custom tag library --foreach
随机推荐
Meeting OA project progress (I)
Work with growingio engineers this time | startdt Hackathon
代码随想录笔记_链表_707设计链表
ArcGIS layer annotation display
Summary of ROS master-slave communication experience
1309. Decode letter to integer mapping
QT generation connection Library
Custom types: Enumeration
709. Convert to lowercase letters
剑指 Offer 48. 最长不含重复字符的子字符串
Live review | wonderful playback of Apache pulsar meetup (including PPT download)
CDN(Content Delivery Network)内容分发网络从入门到与实战
Still shocked by the explosion in the movie? Then you must not miss this explosive plug-in of unity
regular expression
804. Unique Morse code word
Still developing games with unity? Then you're out. Try unity to build an answer system
PS pull out logo
Want to make sandbox games? Then you must not miss this plug-in (unity3d)
Why can't sizeof (ARR) / size (arr[0]) be used to calculate the array length inside the called function?
内核开发