pat 甲级 1006 Sign In and Sign Out

string可以直接比较大小,不用建乱七八糟的数组啥的

#include <cstdio>
#include <iostream>
#include <cstdlib>

using namespace std;

int n;
string firstname, lastname, firsttime, lasttime;

int main(){

    cin >> n;
    for(int i=0 ;i<n ;i++){
        string  name, t;
        cin >> name >> t;
        if(i==0||t<firsttime){
            firstname = name;
            firsttime = t;
        }
        cin >> t;
        if(i==0||t>lasttime){
            lastname = name;
            lasttime = t;
        }

    }
    cout << firstname << " " << lastname;
    return 0;
} 

希望可以把甲级,,

虽然很难对我来说,,我也很菜,,

早日成为大佬吧,,

猜你喜欢

转载自blog.csdn.net/mdzz_z/article/details/81215597