백준 2480

Oak_Cassia·2022년 1월 19일
0

2480

백준 2480

주사위 3개의 눈금의 입력을 받고 상금을 계산하여 출력
1. 같은 눈이 3개가 나오면 10,000원+(같은 눈)×1,000원의 상금을 받게 된다.
2. 같은 눈이 2개만 나오는 경우에는 1,000원+(같은 눈)×100원의 상금을 받게 된다.
3. 모두 다른 눈이 나오는 경우에는 (그 중 가장 큰 눈)×100원의 상금을 받게 된다.

#include<iostream>
class Dice
{
public:
    int a, b, c;
  
    Dice()
    {
        std::cin >> a>>b>>c;
    }
    int PrizePrice()
    {
        int max = a;
        if (a == b && b == c)
            return  10000 + a * 1000;
        if (a == b || a == c)
            return  1000 + a * 100;
        if (b == c)
            return  1000 + b * 100;
        if (max < b)
            max = b;
        if (max < c)
            max = c;
        return max * 100;

    }
};

int main()
{
    Dice d1;
    std::cout << d1.PrizePrice();

}
profile
rust로 뭐할까

0개의 댓글