본문 바로가기
백준

[2456] 나는 학급회장이다

by Jcoder 2018. 8. 23.


#include <iostream>
using namespace std;
int main()
{
int n, i, j;
pair<int ,int> arr[3];
cin >> n;
for (i = 0; i < n; i++)
{
for (j = 0; j < 3; j++)
{
int a;
cin >> a;
arr[j].first += a;
arr[j].second += a*a;
}
}
int max = 0, check = 0;
if (arr[0] < arr[1])
max = 1;
else if (arr[0] == arr[1])
check = 1;
if (arr[max] < arr[2])
{
max = 2;
check = 0;
}
else if (arr[max] == arr[2])
check = 1;
if (check == 0)
cout << 0 << " " << arr[max].first << endl;
else
cout << max + 1 << " " << arr[max].first << endl;
return 0;
}


'백준' 카테고리의 다른 글

[4796] 캠핑  (0) 2018.08.24
[11895] 속이기  (0) 2018.08.23
[1269] 대칭 차집합  (0) 2018.08.21
[9971] The Hardest Problem Ever  (0) 2018.08.19
[9455] 박스  (0) 2018.08.19