AC代码

#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
struct Sign {
char SignInNumber[20];
int h, m, s;
}earlist, least, temp;
/*
struct Time {
int h, m, s
} left, right, temp;
*/
void init() {
earlist.h = 24;
earlist.m = 59;
earlist.s = 59;
least.h = 0;
least.m = 0;
least.s = 0;
}
bool lessEqu(Sign a, Sign b) {
if(a.h != b.h) return a.h <= b.h;
else if(a.m != b.m) return a.m <= b.m;
else return a.s <= b.s;
} bool moreEqu(Sign a, Sign b) {
if(a.h != b.h) return a.h >= b.h;
else if(a.m != b.m) return a.m >= b.m;
else return a.s >= b.s;
} int main(){
init();
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif // ONLINE_JUDGE}
int n;
scanf("%d", &n);
for(int i = 0; i < n; i++) {
char name[20] = {0};
scanf("%s %d:%d:%d", temp.SignInNumber, &temp.h, &temp.m, &temp.s);
if(lessEqu(temp, earlist)) {
earlist = temp;
//earlist.SignInNumber = name;
}
//scanf("%d:%d:%d", &temp.h, &temp.m. &temp.s);
scanf("%d:%d:%d", &temp.h, &temp.m, &temp.s);
if(moreEqu(temp, least)) {
least = temp;
//least.SignInNumber = name;
}
}
printf("%s %s", earlist.SignInNumber, least.SignInNumber);
return 0;
}

PAT A1006 Sign In and Sign Out (25)的更多相关文章

  1. PAT (Advanced Level) Practice 1006 Sign In and Sign Out (25 分) 凌宸1642

    PAT (Advanced Level) Practice 1006 Sign In and Sign Out (25 分) 凌宸1642 题目描述: At the beginning of ever ...

  2. PAT 甲级 1006 Sign In and Sign Out (25)(25 分)

    1006 Sign In and Sign Out (25)(25 分) At the beginning of every day, the first person who signs in th ...

  3. PAT甲 1006. Sign In and Sign Out (25) 2016-09-09 22:55 43人阅读 评论(0) 收藏

    1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  4. pat 1006 Sign In and Sign Out(25 分)

    1006 Sign In and Sign Out(25 分) At the beginning of every day, the first person who signs in the com ...

  5. 1006 Sign In and Sign Out (25 分)

    1006 Sign In and Sign Out (25 分) At the beginning of every day, the first person who signs in the co ...

  6. PAT Sign In and Sign Out[非常简单]

    1006 Sign In and Sign Out (25)(25 分) At the beginning of every day, the first person who signs in th ...

  7. 1006 Sign In and Sign Out (25)(25 分)思路:普通的时间比较题。。。

    1006 Sign In and Sign Out (25)(25 分) At the beginning of every day, the first person who signs in th ...

  8. pat1006. Sign In and Sign Out (25)

    1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  9. PAT甲级——1006 Sign In and Sign Out

    PATA1006 Sign In and Sign Out At the beginning of every day, the first person who signs in the compu ...

  10. PAT1006:Sign In and Sign Out

    1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

随机推荐

  1. Java的23种设计模式<一>

    设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结.使用设计模式是为了可重用代码.让代码更容易被他人理解.保证代 码可靠性. 毫无疑问,设计模式 ...

  2. Digit Division(排列组合+思维)(Gym 101480D )

    题目链接:Central Europe Regional Contest 2015 Zagreb, November 13-15, 2015 D.Digit Division(排列组合+思维) 题解: ...

  3. 7.20套娃(tao)

    套娃(tao) input7 39 53 710 65 102 610 104 110 53 53 9output012 sol: 把查询想象成(x1,y1)向(x2,y2)有边当且仅当(x1< ...

  4. python 二维数组 转 矩阵

    x = numpy.array([[,,],[,,],[,,]]) print x print x.shape 输出 [[ ] [ ] [ ]] (3L, 3L) [Finished .2s]

  5. 【java设计模式】-00目录

    开篇 [java设计模式]-01设计模式简介 创建型模式: [java设计模式]-02工厂模式(Factory Pattern) [java设计模式]-03抽象工厂模式(Abstract Factor ...

  6. Java中二维数组

    二维数组:(其实是一个一维数组,它的每一个元素又是一个一维数组), 可以看做是一张表格. 初始化: 动态初始化 int[ ][ ]  arr = new int[3][2]; 定义了一个二维数组,其中 ...

  7. 重写equals为啥需要重写hashCode

    描述 以前一直记得重写equals要把hashCode也要重写了,但是一直也是没有搞明白, 最近在看一些东西,觉得有必要记录一下. 了解一下equals equals是Object类的方法, equa ...

  8. logserver 日志服务项目发布

    logserver是使用logback.light-4j.commons-exec等构建的简单日志服务,参考项目logbackserver和light4j,支持跟踪日志.分页查看.搜索定位.下载文件等 ...

  9. cloud toolkit同时部署多个服务器

    首先安装cloud toolkit安装完成之后重启idea 添加host主机信息: 部署到远程服务器 具体信息: 配置本地查看服务器日志信息 启动脚本信息 start.sh #! /bin/sh so ...

  10. QList和QVector等容器的区别

    QList和QVector等容器的区别. 1.大多数情况下可以用QList.像prepend()和insert()这种操作,通常QList比QVector快的多.这是因为QList是基于index标签 ...