[백준] C# 2480 주사위 세개

yewonjune·2025년 2월 6일

백준을 풀어보자

목록 보기
3/12

https://www.acmicpc.net/problem/2480
-> 백준 2480번 링크

오늘은 백준 단계별로 풀어보기의 조건문 7번 문제인 주사위 세 개를 풀어보자!


조건에 따라 상금을 계산하는 문제이다.

[코드]

namespace ConsoleApp1

{
    internal class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] v = s.Split();

            int a = int.Parse(v[0]);
            int b = int.Parse(v[1]);
            int c = int.Parse(v[2]);

            if (a == b && b == c)
            {
                Console.WriteLine(10000+a*1000);
            }
            else if (a == b)
            {
                Console.WriteLine(1000 + a * 100);
            }
            else if (b == c)
            {
                Console.WriteLine(1000 + b * 100);
            }
            else if (a == c)
            {
                Console.WriteLine(1000 + a * 100);
            }
            else
            {
                int max = Math.Max(a, Math.Max(b, c));
                Console.WriteLine(max*100);
            }

        }
    }
}


맞았습니다!!

profile
게임만드는 백수

0개의 댓글