• 杭电1234--开门人和关门人


    开门人和关门人

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
    Total Submission(s): 12296    Accepted Submission(s): 6222


    Problem Description
    每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。现有一堆杂乱的机房签
    到、签离记录,请根据记录找出当天开门和关门的人。
     

     

    Input
    测试输入的第一行给出记录的总天数N ( > 0 )。下面列出了N天的记录。
    每天的记录在第一行给出记录的条目数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   |   We have carefully selected several similar problems for you:  1231 1228 1236 1235 1230 
    //AC:
     1 #include <stdio.h>
     2 #include <string.h>
     3 #include <algorithm>
     4 using namespace std ;
     5 struct people
     6 {
     7     char num[100] ;
     8     char begin[30] ;
     9     char end[30] ;
    10 } ;
    11 people t[1001] ;
    12 
    13 bool cmp(people begin , people end)
    14 {
    15     return strcmp(begin.begin ,end.begin) < 0 ; 
    16 }
    17 
    18 bool compare(people begin, people end)
    19 {
    20     return strcmp(begin.end, end.end) > 0 ;    
    21 } 
    22 int main()
    23 {
    24     int i, m, n ;
    25     while(~scanf("%d",&m))
    26     {
    27         while(m--)
    28         {
    29             scanf("%d", &n) ;
    30             for(i=0; i<n; i++)
    31             scanf("%s %s %s", t[i].num, t[i].begin, t[i].end) ;
    32             sort(t, t+n, cmp) ;
    33             printf("%s",t[0].num) ;
    34             sort(t, t+n, compare) ;
    35             printf(" %s
    ",t[0].num ) ;
    36         }
    37     }
    38     return 0 ;
    39 }
  • 相关阅读:
    linux查看端口
    linux下Git代码
    linux安装mysql
    pip工具更新及解决"No module named pip"问题
    demo-bootstrap实现滑动开关
    vue 随笔
    css 解决盒子移动鼠标丢失产生的抖动问题
    笔记-纯css实现select的placeholder
    笔记-移动端rem适配和解决安卓手机键盘唤起引起样式问题
    demo-tab切换
  • 原文地址:https://www.cnblogs.com/soTired/p/4668596.html
Copyright © 2020-2023  润新知