1006 Sign In and Sign Out (25分)

1006 Sign In and Sign Out (25分)

#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int min=60+24*60+24*3600,max=0;
    string mins,maxs,temps;
    int a,b,c,d,e,f;
    int n;
    int temp1,temp2;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        cin>>temps;
        scanf("%d:%d:%d %d:%d:%d",&a,&b,&c,&d,&e,&f);
        temp1=a*3600+b*60+c;
        temp2=d*3600+e*60+f;
        if(temp1<min){
            min=temp1;
            mins=temps;
        }
        if(temp2>max){
            max=temp2;
            maxs=temps;
        }
    }
    cout<<mins<<" "<<maxs;
    return 0;
}
// 日期 时间比较大小直接将日期或时间乘以相应的周期得出一个最终结果来进行比较

  

上一篇:js计算时间差(天,小时,分钟,秒)


下一篇:比特币P2P网络之节点发现