当前位置:网站首页>Hdu1234 door opener and door closer (water question)
Hdu1234 door opener and door closer (water question)
2022-07-02 10:55:00 【Woodenman Du】
Topic link http://acm.hdu.edu.cn/showproblem.php?pid=1234
Question
Problem Description
The first person to the computer room every day should open the door , The last person to leave is to close the door . There are a lot of messy machine room signs
To 、 Check out record , Please find out who opened and closed the door according to the record .
Input
The first line of the test input gives the total number of days recorded N ( > 0 ). The following is listed N A record of days .
The daily record gives the number of entries in the first line M ( > 0 ), Here is M That's ok , The format of each line is :
ID number Check in time Check out time
The time is according to “ Hours : minute : Second ”( Each account 2 position ) give , The ID number is no longer than 15 String .
Output
Output the record of each day 1 That's ok , That is, the ID number of the person who opened and closed the door that day , Intermediate use 1 The blank space to separate .
Be careful :
In the referee's standard test input , All records shall be complete , Everyone's check-in time is before the check-out time ,
And there is no situation that many people sign in or sign out at the same time .

Solve
Find the smallest and largest in a pile of time , Just pay attention to format control
AC Code
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int t, n;
int main(void)
{
scanf("%d", &t);
while(t--){
scanf("%d", &n);
string en, st; // Starting and ending Certificate No
int t_en = -1, t_st = 1e9; // Starting and ending time
int h1, h2, m1, m2, s1, s2;
for(int i = 1; i <= n; i++){
string s; cin >>s;
// Read in time
scanf("%02d:%02d:%02d", &h1, &m1, &s1);
scanf("%02d:%02d:%02d", &h2, &m2, &s2);
// Calculation
int t1 = h1 * 3600 + m1 * 60 + s1;
int t2 = h2 * 3600 + m2 * 60 + s2;
// Compare
if(t1 < t_st) { st = s; t_st = t1; }
if(t2 > t_en) { en = s; t_en = t2; }
}
cout <<st <<" " <<en <<endl;
}
return 0;
}边栏推荐
- (五)APA场景搭建之挡位控制设置
- 《MySQL 8 DBA基础教程》简介
- AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
- SPSS做Shapiro-Wilk正态分析
- Session cookies and tokens
- UVM——Callback
- flink 提交程序
- The nanny level tutorial of flutter environment configuration makes the doctor green to the end
- STM32 and motor development (upper system)
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
猜你喜欢

Operator-1 first acquaintance with operator

从MediaRecord录像中读取H264参数

2022-06-17
![[Fantasy 4] the transformation from U3D to UE4](/img/bb/665eba3c8cd774c94fe14f169121da.png)
[Fantasy 4] the transformation from U3D to UE4

Redis set password

Mongodb quickly get started with some simple operations of mongodb command line

4. Random variables

Mysql database remote access permission settings

Read H264 parameters from mediarecord recording

Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
随机推荐
集成学习概览
Flink calculates topn hot list in real time
Easyexcel, a concise, fast and memory saving excel processing tool
In the face of uncertainty, the role of supply chain
PCL 点云转深度图像
13.信号量临界区保护
(5) Gear control setting of APA scene construction
01-spooldir
LabVIEW为什么浮点数会丢失精度
[visual studio] visual studio 2019 community version cmake development environment installation (download | install relevant components | create compilation execution project | error handling)
"Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
Record attributeerror: 'nonetype' object has no attribute 'nextcall‘
Analysis of hot spots in AI technology industry
02-taildir source
session-cookie与token
Solutions to a series of problems in sqoop job creation
Importing tables from sqoop
6种单例模式的实现方式
MySQL数据库远程访问权限设置
使用sqlcipher打开加密的sqlite方法