zoukankan      html  css  js  c++  java
  • HDU 1234 简单模拟题

    题目很简单不多说了,我只是觉得这题目的输入方式还是很有特点的

     1 #include <cstdio>
     2 #include <cstring>
     3 #include <algorithm>
     4 #include <iostream>
     5 using namespace std;
     6 
     7 struct People{
     8     char name[20];
     9     int h1 , h2 , m1 , m2 , s1 , s2;
    10 }p[10005];
    11 
    12 bool cmp1(const People &p1 , const People &p2){
    13     if(p1.h1 == p2.h1 && p2.m1 == p1.m1) return p1.s1 < p2.s1;
    14     else if(p1.h1 == p2.h1) return p1.m1 < p2.m1;
    15     else return p1.h1 < p2.h1;
    16 }
    17 
    18 bool cmp2(const People &p1 , const People &p2){
    19     if(p1.h2 == p2.h2 && p2.m2 == p1.m2) return p1.s2 > p2.s2;
    20     else if(p1.h2 == p2.h2) return p1.m2 > p2.m2;
    21     else return p1.h2 > p2.h2;
    22 }
    23 
    24 int main()
    25 {
    26   //  freopen("a.in" , "r" , stdin);
    27     int T , n;
    28     scanf("%d" , &T);
    29     while(T--){
    30         scanf("%d" , &n);
    31         memset(p , 0 , sizeof(p));
    32         for(int i = 1 ; i<=n ; i++){
    33             scanf("%s%d:%d:%d%d:%d:%d" , p[i].name , &p[i].h1 , &p[i].m1 ,
    34                   &p[i].s1 , &p[i].h2 , &p[i].m2 , &p[i].s2);
    35            // cout<<p[i].h1<<":"<<p[i].m1<<":"<<p[i].s1<<endl;
    36         }
    37         sort(p+1 , p+n+1 , cmp1);
    38         printf("%s " , p[1].name);
    39         sort(p+1 , p+n+1 , cmp2);
    40         printf("%s
    " , p[1].name);
    41     }
    42     return 0;
    43 }
  • 相关阅读:
    channels的使用
    paramiko模块(远程操作服务器)
    GIT版本管理工具教程
    Python中的魔术方法详解(双下方法)
    Django中Q查询及Q()对象
    Python3操作Excel
    漏洞复现环境集锦-Vulhub
    CVE-2019-0193 远程命令执行-漏洞复现
    Weblogic-SSRF 漏洞复现
    CVE-2020-0796 永恒之蓝?
  • 原文地址:https://www.cnblogs.com/CSU3901130321/p/4194905.html
Copyright © 2011-2022 走看看