本文主要是介绍PAT (Advanced Level) - 1006 Sign In and Sign Out,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
模拟
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;int m;
string open_id, open_time;
string close_id, close_time;int main(){cin >> m;for (int i = 0; i < m; i ++ ) {string id, in_time, out_time;cin >> id >> in_time >> out_time;if (!i || in_time < open_time) { // 更新开门的人open_id = id;open_time = in_time;}if (!i || out_time > close_time) { // 更新锁门的人close_id = id;close_time = out_time;}}cout << open_id << ' ' << close_id << endl;return 0;
}
这篇关于PAT (Advanced Level) - 1006 Sign In and Sign Out的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!