1006. Sign In and Sign Out
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
using namespace std; struct stu
{
char ID[];
int GetTime[];
int LeaveTime[];
}; stu Student[]; int main()
{
int n,i,j;
int m;
while(scanf("%d",&m)!=EOF)
{ for(j=;j<m;j++)
{
scanf("%s %d:%d:%d %d:%d:%d",Student[j].ID,&Student[j].GetTime[],&Student[j].GetTime[],&Student[j].GetTime[],&Student[j].LeaveTime[],&Student[j].LeaveTime[],&Student[j].LeaveTime[]);
} int GetHour,GetMin,GetSec,LeaveHour,LeaveMin,LeaveSec; GetHour=GetMin=GetSec=;
LeaveHour=LeaveHour=LeaveSec=-; int OpenMan,CloseMan; for(j=;j<m;j++)
{
if(Student[j].GetTime[]<GetHour)
{
GetHour=Student[j].GetTime[];
OpenMan=j;
}
else if(Student[j].GetTime[]==GetHour)
{
if(Student[j].GetTime[]<GetMin)
{
GetMin=Student[j].GetTime[];
OpenMan=j;
}
else if(Student[j].GetTime[]==GetMin)
{
if(Student[j].GetTime[]<GetSec)
{
GetSec=Student[j].GetTime[];
OpenMan=j;
}
}
} if(Student[j].LeaveTime[]>LeaveHour)
{
LeaveHour=Student[j].LeaveTime[];
CloseMan=j;
}
else if(Student[j].LeaveTime[]==LeaveHour)
{
if(Student[j].LeaveTime[]>LeaveMin)
{
LeaveMin=Student[j].LeaveTime[];
CloseMan=j;
}
else if(Student[j].LeaveTime[]==LeaveMin)
{
if(Student[j].LeaveTime[]>LeaveSec)
{
LeaveSec=Student[j].LeaveTime[];
CloseMan=j;
}
}
}
} printf("%s %s\n",Student[OpenMan].ID,Student[CloseMan].ID); }
return ;
}
1006. Sign In and Sign Out的更多相关文章
- 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 ...
- 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甲 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 ...
- 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 分)
1006 Sign In and Sign Out(25 分) At the beginning of every day, the first person who signs in the com ...
- 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 ...
- PTA (Advanced Level) 1006 Sign In and Sign Out
Sign In and Sign Out At the beginning of every day, the first person who signs in the computer room ...
- 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 ...
- 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 ...
随机推荐
- css笔记15:盒子模型
1.流 流:html元素在网页中显示的顺序 标准流:在html文件中,写在前面的元素在前面显示,写在后面的html元素在后面显示. 非标准流:在html之中,当某个元素脱离了标准流,那么它处于非标准流 ...
- JavaScript版几种常见排序算法
今天发现一篇文章讲“JavaScript版几种常见排序算法”,看着不错,推荐一下原文:http://www.w3cfuns.com/blog-5456021-5404137.html 算法描述: * ...
- java.lang.IllegalArgumentException: Service Intent must be explicit: Intent
在Activity中启动Service的时候报错: 服务意图必须是显性声明. 这是为了防止造成冲突(i.e. 有多个Service用同样的intent-filter的情况) 这是Android 5.0 ...
- linux下获取ip
如果打开虚拟机 没有ip置灰显示了 lo 可以使用dhclient自动获取ip 如果想开机就自动获取ip: vim /etc/rc.d/rc.local 在这里插入dhclient命令
- [改善Java代码]不要让四舍五入亏了一方
建议25: 不要让四舍五入亏了一方 本建议还是来重温一个小学数学问题:四舍五入.四舍五入是一种近似精确的计算方法,在Java 5之前,我们一般是通过使用Math.round来获得指定精度的整数或小数的 ...
- 【线性结构上的动态规划】UVa 11584 - Partitioning by Palindromes
回文串问题.给出一个字符串,问最少可以划分为多少个字符串子串. 对于判断是否为回文串,对于不是很长的字符串,可以采取直接暴力,即从两边向中间收缩判断字符相等. bool is_pali(int l, ...
- poj3264
Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 45777 Accepted: 21499 ...
- Jersey(1.19.1) - Security
Security information is available by obtaining the SecurityContext using @Context, which is essentia ...
- ASP.NET播客(留言时间,投票IP,留言限字数,上传视频)
留言发布时间功能: 界面: 前台代码: 在Datalist控件中: 在<%#getIsDate(Convert.ToString(Eval("issuanceDate"))) ...
- SSRS 传多值参数问题
SSRS报表参数是可单值或者多值.之前有个小伙伴问我,如果要传多值怎么传.然后我试了在各个参数之间,放换行符放逗号分号等都未能解决问题,最后想明白这个参数接受的应该是非字符类型,很大可能是数组,然后我 ...