- 浏览: 35800 次
文章分类
- 全部博客 (41)
- 卧鸟个去 (2)
- Transform (2)
- Mathmatic (9)
- Plant-Tree (7)
- Data-Struct (12)
- Red-Black-Tree (1)
- Radix-Tree (1)
- Trie (2)
- String (4)
- BST (2)
- Amazing-Union-Find-Set (1)
- HDU (27)
- OJ (32)
- BFS (3)
- Pretty-Suffix-Array (2)
- POJ (6)
- Graceful-Segment-Tree (2)
- Geometry (6)
- Priority-Queue (2)
- Dynamic-Programing (1)
- DP (3)
- LCS (1)
- Convex-Hull (2)
- Triangulation (1)
- DFS (3)
- Combinatorial-Mathematics (2)
- Big-Number (1)
- Statistic (3)
- STL (1)
- Shortest-Path (3)
- ZOJ (1)
- Leftist-Tree (1)
- Prime (1)
- Binary-Index-Tree (1)
- (1)
- Stack (1)
- SPFA (0)
- CRT (1)
开门人和关门人
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5354 Accepted Submission(s): 2759
Problem Description
每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。现有一堆杂乱的机房签
到、签离记录,请根据记录找出当天开门和关门的人。
到、签离记录,请根据记录找出当天开门和关门的人。
Input
测试输入的第一行给出记录的总天数N ( > 0 )。下面列出了N天的记录。
每天的记录在第一行给出记录的条目数M ( > 0 ),下面是M行,每行的格式为
证件号码 签到时间 签离时间
其中时间按“小时:分钟:秒钟”(各占2位)给出,证件号码是长度不超过15的字符串。
每天的记录在第一行给出记录的条目数M ( > 0 ),下面是M行,每行的格式为
证件号码 签到时间 签离时间
其中时间按“小时:分钟:秒钟”(各占2位)给出,证件号码是长度不超过15的字符串。
Output
对每一天的记录输出1行,即当天开门和关门人的证件号码,中间用1空格分隔。
注意:在裁判的标准测试输入中,所有记录保证完整,每个人的签到时间在签离时间之前,
且没有多人同时签到或者签离的情况。
注意:在裁判的标准测试输入中,所有记录保证完整,每个人的签到时间在签离时间之前,
且没有多人同时签到或者签离的情况。
Sample Input
3 1 ME3021112225321 00:00:00 23:59:59 2 EE301218 08:05:35 20:56:35 MA301134 12:35:45 21:40:42 3 CS301111 15:30:28 17:00:10 SC3021234 08:00:00 11:25:25 CS301133 21:45:00 21:58:40
Sample Output
ME3021112225321 ME3021112225321 EE301218 MA301134 SC3021234 CS301133
Source
Recommend
JGShining
水题一条,呢度主要演示STL,同埋运算符重载。
下面代码:
4285170 | 2011-07-29 11:19:50 | Accepted | 1234 | 15MS | 268K | 1038 B | C++ | 10SGetEternal{(。)(。)}! |
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct time { int h, m, s; bool operator < (time &o) { if (h == o.h) { if (m == o.m) { return s < o.s; } else return m < o.m; } else return h < o.h; } }; struct person { char id[20]; time in, out; }; bool cmpi(person &a, person &b) { return a.in < b.in; } bool cmpo(person &a, person &b) { return a.out < b.out; } vector<person> dayp; int main() { int n, m; person tmp; while (scanf("%d", &n) != EOF) { while (n--) { dayp.resize(0); scanf("%d", &m); while (m--) { scanf("%s %d:%d:%d %d:%d:%d", &tmp.id, &tmp.in.h, &tmp.in.m, &tmp.in.s, &tmp.out.h, &tmp.out.m, &tmp.out.s); dayp.push_back(tmp); } sort(dayp.begin(), dayp.begin() + dayp.size(), cmpi); printf("%s ", dayp[0].id); sort(dayp.begin(), dayp.begin() + dayp.size(), cmpo); printf("%s\n", dayp[dayp.size() - 1].id); } } return 0; }
搞掂…………
发表评论
-
HDU 1370 Biorhythms
2011-08-03 10:27 1143Biorhythms Time Limit: 2000/10 ... -
HDU 1075 What Are You Talking About
2011-08-04 11:00 828What Are You Talking About Tim ... -
HDU 1058 Humble Numbers
2011-08-02 15:55 1164Humble Numbers Time Limit: 200 ... -
HDU 2095 find your present (2)
2011-08-02 16:13 757find your present (2) Time Lim ... -
HDU 1022 Train Problem I
2011-08-02 21:00 989Train Problem I Time Limit: 20 ... -
2142 HDU box
2011-08-02 21:21 728box Time Limit: 3000/1000 MS ( ... -
HDU 2151 Worm
2011-08-01 20:48 777Worm Time Limit: 1000/1000 MS ... -
HDU 2722 Here We Go(relians) Again
2011-08-02 00:06 961Here We Go(relians) Again Time ... -
HDU 3791 二叉搜索树
2011-08-02 14:26 1155二叉搜索树 Time Limit: 20 ... -
PKU 2352 Stars
2011-07-31 21:47 977Stars Time Limit: 1000MS ... -
PKU 2774 Long Long Message
2011-07-31 21:26 856Long Long Message Time Li ... -
PKU 2777 Count Color
2011-07-31 21:31 763Count Color Time Limit: 1 ... -
HDU 2098 分拆素数和
2011-07-31 21:08 1007分拆素数和 Time Limit: 1000/1000 MS ... -
ZOJ 3512 Financial Fraud .
2011-07-31 20:49 1222Financial Fraud Time Limit: 3 ... -
HDU 1798 Tell me the area .
2011-07-31 20:47 1062Tell me the area Time Limit: 3 ... -
HDU 2962 Trucking .
2011-07-31 20:46 634Trucking Time Limit: 20000/100 ... -
HDU 1596 find the safest road .
2011-07-31 20:45 567find the safest road Time Limi ... -
HDU 2553 N皇后问题 .
2011-07-31 20:20 657N皇后问题 Time Limit: 2000/1000 MS ... -
HDU 1392 Surround the Trees .
2011-07-31 20:19 752Surround the Trees Time Limit: ... -
HDU 1316 How Many Fibs? .
2011-07-31 20:15 940How Many Fibs? Time Limit: 200 ...
相关推荐
解题报告|ACM|程序设计参考程序以及题目的分析
hdu5102的ac源码。算法:队列、数据结构、图论、模拟。题意:输入一棵树,输出前k小的点对最短距离dis(i,j)的和。
杭电OJ部分答案,可以很简单的解决a+b求和问题及其他问题。
HDU的一题........HDU DP动态规
杭电OnlineJudge 200-2099的解题报告
杭电选课插件
2.18.1 HDU4656 卷积取模 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 2.19 其它公式 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2.19.1 Polya . . . ....
HDUACM2010版03递推求解.ppt
HDU 里面的2000~2099道题目的源码。谢谢支持
ACM HDU题目分类,我自己总结的大概只有十来个吧
杭电 hdu acm 第1084题的解法,ac过了,是一位学长教我的.内有一些中文说明.
ACM HDU 1404 Digital Deletions(博弈).docx
Hdu 1020解题报告,http://acm.hdu.edu.cn/showproblem.php?pid=1020
杭电acm 一些java语言实现的水题目
本资源为HDU数字图像处理课程 浙江省在线平台的视频课后作业 仅供参考 假设我们有一个mat型的单通道图像,命名为srcMat,我们想得到第i行,第j列的像素值则可以用一下的代码 A. int value= srcMat.at(i)(j)[0]; B...
杭电ACM2000-2099题的解题报告