코딩테스트

성적표

wtdsoul 2024. 9. 16. 21:58


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>

struct Student {
    int n, mat, eng, c;
      
};

int main() {
    Student s[51];  //  51개 배열 
    int i, n, max = - 2147000000, res;
    scanf("%d", &n);
    for(i=1; i<= n; i++) {
        scanf("%d", &s[i].n);
        scanf("%d", &s[i].mat);
        scanf("%d", &s[i].eng);
        scanf("%d", &s[i].c);
    }
    for(i=1; i<=n; i++) {
        if(s[i].mat > max) {
            max = s[i].mat; 
            res = s[i].c;
        }
    }
    printf("%d\n", res);
    

return 0;
}