• HDUOJ----1234 开门人和关门人(浙江大学考研题)


    开门人和关门人

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


    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
     

     代码:

    水体

     1 #include<stdio.h>
     2 #include<string.h>
     3 struct stime
     4 {
     5   char S_str[17];
     6   int shh,smm,sss;
     7   int ehh,emm,ess;
     8 };
     9 
    10 int main()
    11 {
    12    int c , num ,i,mintime,maxtime;
    13    stime aa ;
    14    char st[17],en[17];
    15   scanf("%d",&c);
    16   while(c--)
    17   {
    18       mintime=0x3f3f3f3f;
    19     maxtime=-1;
    20     scanf("%d",&num);
    21     for(i=0;i<num;i++)
    22     {
    23      scanf("%s %d:%d:%d %d:%d:%d",aa.S_str,&aa.shh,&aa.smm,&aa.sss,&aa.ehh,&aa.emm,&aa.ess);
    24       if(mintime>aa.shh*3600+aa.smm*60+aa.sss)
    25       {
    26            strcpy(st,aa.S_str);
    27          mintime=aa.shh*3600+aa.smm*60+aa.sss;
    28       }
    29       if(maxtime<aa.ehh*3600+aa.emm*60+aa.ess)
    30       {
    31             strcpy(en,aa.S_str);
    32               maxtime=aa.ehh*3600+aa.emm*60+aa.ess;
    33       }
    34     }
    35     printf("%s %s
    ",st,en);
    36   }
    37  return 0;
    38 }
    View Code
  • 相关阅读:
    找不到方法 Void Newtonsoft.Json.JsonConvert.set_DefaultSettings
    HDUJ 1203 I NEED A OFFER!
    EasyUI基础入门之Resiable(可缩放)
    6大设计原则(2):里氏替换原则
    scikit-learn:class and function reference(看看你究竟掌握了多少。。)
    NoSQL之Redis探析
    docker 命令汇总2
    【Web应用-FTP】FTP 容量显示说明
    【Web应用-网络连接】关于 Azure Web 应用 4 分钟空闲连接的限制
    【Web应用-网络连接】Azure Web 应用对外连接数上限分析
  • 原文地址:https://www.cnblogs.com/gongxijun/p/3720953.html
Copyright © 2020-2023  润新知