zoukankan      html  css  js  c++  java
  • 1006. Sign In and Sign Out

    C++语言: Codee#25855
    001 /*
    002 +++++++++++++++++++++++++++++++++++++++
    003                 author: chm
    004 +++++++++++++++++++++++++++++++++++++++
    005 */
    006
    007 #include <map>
    008 #include <set>
    009 #include <list>
    010 #include <queue>
    011 #include <cmath>
    012 #include <stack>
    013 #include <bitset>
    014 #include <cstdio>
    015 #include <cctype>
    016 #include <string>
    017 #include <vector>
    018 #include <cassert>
    019 #include <cstdlib>
    020 #include <cstring>
    021 #include <fstream>
    022 #include <sstream>
    023 #include <iomanip>
    024 #include <iostream>
    025 #include <algorithm>
    026
    027 using namespace std;
    028
    029 FILE*            fin         = stdin;
    030 FILE*            fout         = stdout;
    031 const int        max_size     = 10086;
    032 int n;
    033 char tmp[max_size];
    034 char fstid[max_size], lstid[max_size];
    035 int tih, tim, tis;
    036 int toh, tom, tos;
    037 int hour1 = 24, minute1 = 24, second1 = 24;
    038 int hour2 = 0, minute2 = 0, second2 = 0;
    039 /*
    040    saved > current
    041    */
    042 bool checkin()
    043 {
    044     if(hour1 > tih)
    045         return true;
    046     else if(hour1 == tih)
    047         if(minute1 > tim)
    048             return true;
    049         else if(minute1 == tim)
    050             if(second1 > tis)
    051                 return true;
    052     return false;
    053 }
    054
    055 /*
    056    saved < current
    057    */
    058 bool checkout()
    059 {
    060     if(toh > hour2)
    061         return true;
    062     else if(toh == hour2)
    063         if(tom > minute2)
    064             return true;
    065         else if(tom == minute2)
    066             if(tos > second2)
    067                 return true;
    068     return false;
    069 }
    070
    071 #define ONLINE_JUDGE
    072 int main()
    073 {
    074 #ifndef ONLINE_JUDGE
    075     freopen("d:\\in.txt", "r", stdin);
    076     freopen("d:\\out.txt", "w", stdout);
    077 #endif
    078
    079
    080     scanf("%d", &n);
    081     while(n--)
    082     {
    083         scanf("%s%d:%d:%d%d:%d:%d", tmp,
    084               &tih, &tim, &tis,
    085               &toh, &tom, &tos);
    086         if(checkin())
    087         {
    088             hour1 = tih;
    089             minute1 = tim;
    090             second1 = tis;
    091             strcpy(fstid, tmp);
    092         }
    093         if(checkout())
    094         {
    095             hour2 = toh;
    096             minute2 = tom;
    097             second2 = tos;
    098             strcpy(lstid, tmp);
    099         }
    100     }
    101     printf("%s %s\n", fstid, lstid);
    102
    103
    104
    105
    106 #ifndef ONLINE_JUDGE
    107     fclose(stdout);
    108     system("start d:\\check.exe d:\\out.txt d:\\ans.txt");
    109 #endif
    110     return 0;
    111 }
  • 相关阅读:
    hbase2.x错误记录之 disable表卡住
    hbase2.x 错误记录之 procedure is still running
    yarn timelineserver v2 配置
    Linux 系统出现大量的CLOSE_WAIT
    hbase 2.x 异常记录之 hbase shell不能分配内存
    spark 访问 hive,不能获取到数据信息
    hive 由于distcp导致执行sql慢
    Hbase 安装部署
    MooseFS安装部署
    hbase2.x 单节点启动,master挂掉
  • 原文地址:https://www.cnblogs.com/invisible/p/2402885.html
Copyright © 2011-2022 走看看