【PAT甲级】【C++】1006. Sign In and Sign Out (25)
2016-10-20 01:05
645 查看
#include<iostream> #include<stdio.h> #include<string.h> #define N 100000 using namespace std; struct node { char id[15]; int in; int out; }recode ; int main() { int m,i=0,n; int h1,h2,m1,m2,s1,s2; struct node temp_in,temp_out; scanf("%d",&m); n=m;//此处复制m是为了后面for循环用的条件,不然while结束m=0无界限可用 while(m--) { scanf("%s",&recode[i].id); scanf("%d%*c%d%*c%d",&h1,&m1,&s1);//%*c跳过一个字符 scanf("%d%*c%d%*c%d",&h2,&m2,&s2); recode[i].in=h1*3600+m1*60+s1; recode[i].out=h2*3600+m2*60+s2; i++; } temp_in=temp_out=recode[0]; for(i=0;i<n;i++) { if(recode[i].in<temp_in.in) temp_in=recode[i]; if(recode[i].out>temp_out.out) temp_out=recode[i]; } printf("%s %s\n",temp_in.id,temp_out.id); return 0; }
相关文章推荐
- PAT甲级 1006. Sign In and Sign Out (25)
- PAT程序设计考题——甲级1006(Sign In and Sign Out ) C++实现
- PAT TEST甲级1006. Sign In and Sign Out (25)
- 1006. Sign In and Sign Out (25) PAT 甲级
- 浙江大学PAT_甲级_1006. Sign In and Sign Out (25)
- PAT甲级真题及训练集(8)--1006. Sign In and Sign Out (25)
- PAT - 甲级 - 1006. Sign In and Sign Out (25
- PAT(甲级)1006. Sign In and Sign Out (25)
- PAT甲级1006. Sign In and Sign Out (25)
- 【PAT甲级】1006 Sign In and Sign Out(25)——JAVA实现
- PAT(甲级)1006. Sign In and Sign Out (25)
- 【PAT甲级】1006. Sign In and Sign Out (25)
- PAT 甲级 1006. Sign In and Sign Out (25)
- PAT甲级 1006.Sign In and Sign Out(25) 题目翻译与答案
- [PAT甲级]1006. Sign In and Sign Out (25)(找出机房开门锁门的人)
- 1006. Sign In and Sign Out (25) PAT甲级刷题
- 【c++】PAT (Advanced Level) 1006. Sign In and Sign Out (25)
- PAT甲级 1006. Sign In and Sign Out (25)
- PAT-PAT (Advanced Level) Practise 1006. Sign In and Sign Out (25) (简单题)【一星级】
- 【PAT (Advanced Level)】1006. Sign In and Sign Out (25)