Little Jay

[C++] 백준 2476번 주사위 본문

알고리즘/BOJ

[C++] 백준 2476번 주사위

Jay, Lee 2021. 3. 6. 21:21

이 문제가 뭐라고

5번이나 시도했는지 모르겠다.....

 

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {

	int participant;
	cin >> participant;
	vector<int> sum;

	for (int i = 0; i < participant; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if (a == b && b == c) {
			sum.push_back(10000 + (a * 1000));
		}
		else if (a == b) {
			sum.push_back(1000 + (a * 100));
		}
		else if (a == c) {
			sum.push_back(1000 + (a * 100));
		}
		else if (b == c) {
			sum.push_back(1000 + (b * 100));
		}
		else {
			int arr[3];
			arr[0] = a;
			arr[1] = b;
			arr[2] = c;
			int max = arr[0];
			for (int i : arr) {
				if (i > max) {
					max = i;
				}
			}
			sum.push_back(max * 100);
		}
	}
	sort(sum.begin(), sum.end());

	cout << sum[sum.size() - 1] << "\n";

	return 0;
}

'알고리즘 > BOJ' 카테고리의 다른 글

[C++] 백준 8958번 OX퀴즈  (0) 2021.03.08
[C++] 백준 2657번 문자열 반복  (0) 2021.03.07
[C++] 백준 1284번 집 주소  (0) 2021.03.06
[C++] 백준 3052번 나머지  (0) 2021.03.06
[C++] 백준 14656번 조교는 새디스트야!!  (0) 2021.03.06
Comments