반응형
#include <iostream>
using namespace std;
int main() {
int arr[3], cnt = 0, big = 0, last = 0, T, score = 0;
cin >> T;
for (int i = 0; i < T; i++)
{
for (int i = 0; i < 3; i++)
{
cin >> arr[i];
}
for (int i = 0; i < 2; i++)//같은게 있는지 찾음
{
for (int j = i + 1; j < 3; j++)
{
if (arr[i] == arr[j])
cnt++;
}
}
switch (cnt)
{
case 3:
score = 10000 + arr[0] * 1000;
if (score > last)
last = score;
break;
case 1:
for (int i = 0; i < 2; i++)//같은게 있는지 찾음
{
for (int j = i + 1; j < 3; j++)
{
if (arr[i] == arr[j])
{
score = 1000 + arr[i] * 100;
if (score > last)
last = score;
break;
}
}
}
break;
case 0:
for (int i = 0; i < 3; i++)
{
if (arr[i] > big)
big = arr[i];
}
score = 100 * big;
if (score > last)
last = score;
break;
}
cnt = 0;
big = 0;
}
cout << last << '\n';
}
'Algorithm' 카테고리의 다른 글
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 3047번:ABC 답 (0) | 2016.11.23 |
---|---|
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 10214번:Baseball 답 (0) | 2016.11.22 |
(C++) - 백준(BOJ) 2480 : 주사위 세개 답 (0) | 2016.11.22 |
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 1357번:뒤집힌 덧셈 답 (0) | 2016.11.22 |
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2490번:윷놀이 답 (0) | 2016.11.20 |