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 ...
随机推荐
- SSIS 学习(1): 概要【转】
俗话说:“十年磨一剑”,Microsoft 通过5年时间的精心打造,于2005年浓重推出Sql Server 2005,这是自SQL Server 2000 以 后的又一旷世之作.这套企业级的数据库解 ...
- UVA442 Matrix Chain Multiplication 矩阵运算量计算(栈的简单应用)
栈的练习,如此水题竟然做了两个小时... 题意:给出矩阵大小和矩阵的运算顺序,判断能否相乘并求运算量. 我的算法很简单:比如(((((DE)F)G)H)I),遇到 (就cnt累计加一,字母入栈,遇到) ...
- java 操作sqllite的数据库
介绍 sqllite是一个小型数据库,不依赖于数据库服务器,操作它可以像操作本地的文本文件一样.在Android中是用来存储数据到本地的,java中可能也会有用到sqllite需要. 详细 sqlli ...
- Kali+Win7双系统
----------------------------------------------------------前言---------------------------------------- ...
- Scala的基本语法总结
Scala的函数: 目前博客园中的代码编辑器中还不支持Scala语言....用的Java代码的存储方式 object TestScala { def main(args: Array[String]) ...
- 转:一个C语言实现的类似协程库(StateThreads)
http://blog.csdn.net/win_lin/article/details/8242653 译文在后面. State Threads for Internet Applications ...
- MyBatis(3.2.3) - Multiple results as a map
If we have a mapped statement that returns multiple rows and we want the results in a HashMap with s ...
- ASP多行多列显示代码
<table width="98%" border="0" align="center"> <tr> <% S ...
- JAVA开发:分享一些SpringMvc+Ibatis+spring的框架使用心得
近期不在做.net的项目,而是使用java作为开发语言,就想着要用springmvc开发了,由于前些年也用过struts1/2+hibernate/ibatis+spring开发过项目,因此是有些底子 ...
- JavaScript之图片滚动
向上滚动: <!doctype html> <title>javascript无缝滚动</title> <meta charset="utf-8&q ...