当前位置:网站首页>1006 Sign In and Sign Out (25分)
1006 Sign In and Sign Out (25分)
2022-08-09 10:48:00 【Cutecumber】
1006 Sign In and Sign Out (25分)
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in’s and out’s, you are supposed to find the ones who have unlocked and locked the door on that day.
Input Specification:
Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:
ID_number Sign_in_time Sign_out_time
where times are given in the format HH:MM:SS, and ID_numberis a string with no more than 15 characters.
Output Specification:
For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.
Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.
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 <string>
#include <iostream>
#include <vector>
using namespace std;
vector<string>table[100];
int main(){
int n;
char *pch;
string ID, SignIn, SignOut;
string max = "00:00:0/", min = "25:00:00";
int index_earlist, index_latest;
cin >> n;
for(int i=0; i<n; i++){
cin >> ID >> SignIn >> SignOut;
table[i].push_back(ID);
table[i].push_back(SignIn);
table[i].push_back(SignOut);
}
//找大小
for(int i=0; i<n; i++){
if(table[i][1] < min){
min = table[i][1];
index_earlist = i;
}
if(table[i][2] > max){
max = table[i][2];
index_latest = i;
}
}
cout << table[index_earlist][0] << ' '+table[index_latest][0] << endl;
return 0;
}
边栏推荐
- Solve the ali cloud oss - the original 】 【 exe double-click response can't open, to provide a solution
- Received your first five-figure salary
- Probably 95% of the people are still making PyTorch mistakes
- TensorFlow—计算梯度与控制梯度 : tf.gradients和compute_gradients和apply_gradients和clip_by_global_norm控制梯度
- 备份mongodb数据库(认证)
- 数据存储:对dataframe类,使用to_csv()将中文数据写入csv文件
- For versions corresponding to tensorflow and numpy, report FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate
- 力扣(LeetCode)220. 存在重复元素 III(2022.08.08)
- Oracle数据库:for update 和for update nowait的区别
- 15.10 the POSIX semaphore Unix environment programming chapter 15
猜你喜欢
随机推荐
TensorFlow: NameError: name 'input_data' is not defined
WUSTOJ:n个素数构成等差数列
For versions corresponding to tensorflow and numpy, report FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate
shap库源码和代码实现
1002 写出这个数 (20 分)
深度学习--循环神经网络(Recurrent Neural Network)
性能测试(05)-表达式和业务关联-json关联
Tensorflow realize parameter adjustment of linear equations
The complete grammar of CSDN's markdown editor
verbose np.matmul/np.dot/np.multiply/tf.matmul/tf.multiply/*
1005 继续(3n+1)猜想 (25 分)
centos7.5 设置Mysql开机自启动
torch.cat()函数的官方解释,详解以及例子
Oracle数据库:for update 和for update nowait的区别
【原创】JPA中@PrePersist和@PreUpdate的用法
相伴成长,彼此成就 用友U9 cloud做好制造业数智化升级的同路人
unix环境编程 第十四章 14.4 I/O多路转接
类与对象 (下)
Shell script combat (2nd edition) / People's Posts and Telecommunications Press Script 2 Validate input: letters and numbers only
torch.stack()的官方解释,详解以及例子









