취미로 음악을 하는 개발자

[C++] 백준 2476. 주사위 게임 본문

공대인/Nojam

[C++] 백준 2476. 주사위 게임

영월특별시 2019. 5. 5. 20:15
728x90




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

int main()
{
int count;
cin >> count;
int result = 0;
for (int c = 0; c < count; c++)
{
list<int> arr;
list<int>::iterator it;
int temp;
int max = 0;
int same = 0;
int sum = 0;
for (int i = 0; i < 3; i++)
{
cin >> temp;
if (max < temp)
max = temp;
it = find(arr.begin(), arr.end(), temp);
if (it != arr.end())
same = temp;
else
arr.push_back(temp);
}

if (arr.size() == 3)
sum = max * 100;

else if (arr.size() == 2)
sum = 1000 + (same*100);

else
sum = 10000 + (same * 1000);

if (result < sum)
result = sum;
}

cout << result << endl;
}


2480. 주사위 세개 문제에서 한 번하는 것을 원하는 만큼 시도하는 것으로 바뀌었다.



Comments