알고리즘

[알고리즘] 백준 11098 - 첼시를 도와줘! (C++)

blueberrysoda 2024. 9. 3. 22:49

[문제 링크] : https://www.acmicpc.net/problem/11098

#include <iostream>
using namespace std;

int main(){
    int T, N;
    cin >> T;

    while(T--){
        cin >> N;
        int cnt = 0, inp;
        string s, tmp;
        for(int i=0; i<N; i++){
            cin >> inp >> tmp;
            if(inp > cnt){
                cnt = inp;
                s = tmp;
            }
        }
        cout << s << "\n";
    }
    
    return 0;
}