링크 : https://www.acmicpc.net/problem/1267
#include <iostream>
using namespace std;
int main() {
int num = 0;
cin >> num;
int sum_y = 0;
int sum_m = 0;
for(int i = 0; i < num; i++){
int temp = 0;
cin >> temp;
sum_y += 10 + (temp/30) * 10;
sum_m += 15 + (temp/60) * 15;
}
if(sum_y < sum_m){
cout << "Y " << sum_y << endl;
}
else if(sum_y > sum_m){
cout << "M " << sum_m << endl;
}
else{
cout << "Y M " << sum_y << endl;
}
return 0;
}