https://www.acmicpc.net/problem/2953
- python
import sys
score = {}
for i in range(5):
s = sum(list(map(int, sys.stdin.readline().split())))
score[i+1] = s
score = sorted(score.items(), key = lambda x : x[1])
for i in score[-1]:
print(i, end=" ")
- C++
#include<iostream>
#include<vector>
#include<string>
#include<string.h>
#include<algorithm>
#include<sstream>
using namespace std;
int main(void) {
int temp;
int arr[5][4];
int Max = 0, maxIndex = 0;
for (int j = 0; j < 5; j++) {
int Sum = 0;
for (int i = 0; i < 4; i++) {
cin >> temp;
arr[j][i] = temp;
Sum += temp;
}
if (Sum > Max) {
Max = Sum;
maxIndex = j + 1;
}
}
cout << maxIndex << " " << Max;
}
'자기개발👨💻 > 코딩 알고리즘' 카테고리의 다른 글
[python] 프로그래머스 실패율 (0) | 2022.02.10 |
---|---|
[C++] 백준 5054 주차의 신 (0) | 2022.02.03 |
[python, C++] 백준 1292 쉽게 푸는 문제 (0) | 2022.02.03 |
[python, C++] 백준 2711 오타맨 고창영 (0) | 2022.02.03 |
[python, C++] 백준 2592 대표값 (0) | 2022.01.30 |
[python, C++] 백준 2577 숫자의 개수 (0) | 2022.01.30 |