HDU 1234 简单模拟题
2014-12-31 02:00
218 查看
题目很简单不多说了,我只是觉得这题目的输入方式还是很有特点的
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; struct People{ char name[20]; int h1 , h2 , m1 , m2 , s1 , s2; }p[10005]; bool cmp1(const People &p1 , const People &p2){ if(p1.h1 == p2.h1 && p2.m1 == p1.m1) return p1.s1 < p2.s1; else if(p1.h1 == p2.h1) return p1.m1 < p2.m1; else return p1.h1 < p2.h1; } bool cmp2(const People &p1 , const People &p2){ if(p1.h2 == p2.h2 && p2.m2 == p1.m2) return p1.s2 > p2.s2; else if(p1.h2 == p2.h2) return p1.m2 > p2.m2; else return p1.h2 > p2.h2; } int main() { // freopen("a.in" , "r" , stdin); int T , n; scanf("%d" , &T); while(T--){ scanf("%d" , &n); memset(p , 0 , sizeof(p)); for(int i = 1 ; i<=n ; i++){ scanf("%s%d:%d:%d%d:%d:%d" , p[i].name , &p[i].h1 , &p[i].m1 , &p[i].s1 , &p[i].h2 , &p[i].m2 , &p[i].s2); // cout<<p[i].h1<<":"<<p[i].m1<<":"<<p[i].s1<<endl; } sort(p+1 , p+n+1 , cmp1); printf("%s " , p[1].name); sort(p+1 , p+n+1 , cmp2); printf("%s\n" , p[1].name); } return 0; }
相关文章推荐
- HDU 4484 Hailstone HOTPO (简单模拟题)
- hdu 1302(简单模拟题)
- hdu 1302(简单模拟题)
- HDU 4772 Zhuge Liang's Password (简单模拟题)
- hdu 4751 Divide Groups(简单模拟题)
- HDU 4772 Zhuge Liang's Password (简单模拟题)
- 开门人和关门人(hdu1234字符串模拟题)
- HDU_1234_开门人和关门人【简单题】
- HDU 1222(数论,简单题)
- hdu 2454 Degree Sequence of Graph G 已知各点度,问能否组成一个简单图
- HDU 1761(模拟题,字典树)
- hdu 1234 开门人和关门人
- HDU 1160 FatMouse's Speed 最长上升子序列 简单DP
- 【模拟题,未知算法】hdu hdoj 1761 Spring-outing Decision(2)
- hdu 1241 Oil Deposits 简单八个方向的DFS
- hdu1241——Oil Deposits(广搜的简单应用)
- HDU 1087 简单DP
- HDU 1266 (让我崩溃至死的简单题!!!!!!)
- HDU 1234 开门人和关门人
- HDU 1231 (简单DP问题)