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. 新西达电调初始化代码,使用nodejs ffi技术调用wiringpi,代码使用typescript编写

    这是我设计的F450四轴飞行器飞控代码的一部分 运行在orangepi-zero上,操作系统是armbian,思路是使用node-ffi调用wiringpi的so库与GPIO通信,然后控制端逻辑代码使 ...

  2. 【零基础】Selenium:Webdriver图文入门教程java篇(附相关包下载)

    一.selenium2.0简述 与一般的浏览器测试框架(爬虫框架)不同,Selenium2.0实际上由两个部分组成Selenium+webdriver,Selenium负责用户指令的解释(code), ...

  3. antd源码分析之——标签页(tabs 3.Tabs的滚动效果)

    由于ant Tabs组件结构较复杂,共分三部分叙述,本文为目录中第三部分(高亮) 目录 一.组件结构 antd代码结构 rc-ant代码结构 1.组件树状结构 2.Context使用说明 3.rc-t ...

  4. go module 使用举例

    go语言中,从1.11开始,引入module,进行版本管理. 通过使用module,工程目录的位置不用必须放在GOPATH下. 本文介绍 module的使用. 下文中用的Go版本是1.13. 1. g ...

  5. jQuery九类选择器

    目的:通过选择器,能定位web页面(HTML/JSP/XML)中的任何标签, 注意:项目中,通常是多种选择器一起使用 基本选择器 <html> <head> <meta ...

  6. hibernate关联总结

    在一对多与多对一的关联关系中,保存数据最好的通过多的一方来维护关系,这样可以减少update语句的生成,从而提高hibernate的执行效率! 配置一对多与多对一,这种叫“双向关联” 只配置一对多,  ...

  7. 如何打开DOS控制台

    A:xp下如何打开DOS控制台? a:开始--程序--附件--命令提示符 b:开始--运行--cmd--回车 c:win+r--cmd--回车 B:win7下如何打开DOS控制台? a:开始--所有程 ...

  8. UI布局属性大全

    第一类:属性值为true或false android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 android:la ...

  9. centos6里面装zabbix(二)

    第一步: 如果这一步的时候有错误,那么修改php.ini(/usr/local/php/etc/这个目录下),然后重启php这个配置文件. 第二步: 第三步: 第四步: 第五步: 第六步:做到这一步的 ...

  10. Jmeter 时间函数

    1.参数值是日期,而日期是当前时间:用__time函数,生成任意格式时间 把生成的函数字符串直接复制粘贴即可使用 2.参数是昨天或者明天,即以当前时间为基准,增加或减少固定时间的,可以用__timeS ...