Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- Operating System
- 컴공과
- 정석
- cs
- 너비우선탐색
- 백준
- 그래프
- Stack
- 알고리즘
- 브루트포스
- OS
- 스택
- bfs
- DP
- 코테
- 북리뷰
- c++
- 개발
- 코딩
- coding
- Computer science
- 오에스
- 문제풀이
- 컴퓨터공학과
- vector
- 자료구조
- 오퍼레이팅시스템
- 컴공
- 정석학술정보관
- 구현
Archives
- Today
- Total
Little Jay
[C++] 백준 2476번 주사위 본문
이 문제가 뭐라고
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