본문 바로가기

Algorithm

(C++) - 백준(BOJ) 11557번 : Yangjojang of the year 답

반응형

 

#include <iostream>
#include <string>
using namespace std;
int t, n, big,ib;
struct YJJ {
    string school;
    int c;
};
int main() {
    cin >> t;
    while (t--)
    {
        cin >> n;
        YJJ *y = new YJJ[n];
        for (int i = 0; i < n; i++)
        {
            cin >> y[i].school >> y[i].c;
            if (big < y[i].c)
            {
                big = y[i].c;
                ib = i;
            }
        }
        cout << y[ib].school << '\n';
    }
}