PAT A1006 Sign In and Sign Out (25)
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)的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- pat1006. Sign In and Sign Out (25)
1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
- 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 ...
- PAT1006:Sign In and Sign Out
1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
随机推荐
- [转载]作为理工科学生,我们为什么要练就好的文笔?我们需要发blog来记录学习历程?
文/JoeyChen 工程师该怎样才能突破自己的能力瓶颈?写 blog! 工程师该怎样精进自己在职涯上所需要的能力?写 blog! 工程师该怎样才能保持学习与成长的动能?写 blog! 工程师该怎样才 ...
- Contos 安装Tomcat
# 下载安装包 wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.40/bin/apache-tomcat-8. ...
- Linux文件的加压缩解压缩tar命令
linux下使用tar命令 解压 语法:tar [主选项+辅选项] 文件或者目录 使用该命令时,主选项是必须要有的,它告诉tar要做什么事情,辅选项是辅助使用的,可以选用.主选项:c 创建新的档案 ...
- 压力测试 Jmeter的简单测试及常用查看结果参数介绍
(1)保存方案 (2)创建线程组 线程组用来模拟用户的并发访问 线程组主要包含三个参数:线程数.准备时长(Ramp-Up Period(in seconds)).循环次数. 线程数:虚拟用户数.一个虚 ...
- Netfilter 之 iptable_nat
初始化 iptable_nat_table_init函数通过调用ipt_register_table完成NAT表注册和钩子函数注册的功能:该流程与iptable_filter的函数调用的函数一致,此处 ...
- 【软件工程】Beta版本演示
团队信息 队名:女生都队 组长博客: 博客链接 成员 学号 史恩泽(组长) 031702122 施金海 031702121 阮君曦 031702116 陈银山 031702137 李季城 031702 ...
- [实战]扩展一个定制的sentinel JdbcDataSource
Sentinel是今年阿里开源的高可用防护的流量管理框架. git地址:https://github.com/alibaba/Sentinel wiki:https://github.com/alib ...
- Android解决AVD Hardware Buttons 和DPAD无法使用问题
如图所示按键用鼠标点击时无法响应. 解决方案: 以我创建的AVD名为Tablet为例 1.找到用户目录(我的用户目录yummy),然后进入如下目录 mac: ~/yummy/.android/avd/ ...
- leetcode16 最接近的三数之和
做了几周的hard之后,这道题居然轻易就解出来了,稍微debug了一下就ac了,算是有了一丢丢提高把: 思路 这道题因为和三数之和很像,所以充分利用双指针的思想:先排序,然后再固定一个数i,i取值从[ ...
- react封装基于axios的API请求
一.最近做的一个后台管理项目,基于antd-pro做的,需要封装基于axios请求,便于开发,直接上代码. import axios from 'axios'; export const Method ...