백준

백준 3003번 c#

대왕군 2024. 1. 15. 16:47

 

using System;

namespace Baekjoon
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //킹, 퀸, 룩, 비숍, 나이트, 폰 순서대로 기물개수
            int[] chess = { 1, 1, 2, 2, 2, 8 };
            //입력값 띄어쓰기로 분리하여 배열에 저장
            string[] input = Console.ReadLine().Split();
            //결과값 저장할 배열
            int[] result = new int[6];

            //기물종류 개수인 총 6번 반복
            for (int i = 0; i < input.Length; i++)
            {
                //원래 기물수에서 내가 입력한 기물수를 빼서 결과값으로 저장
                result[i] = chess[i] - int.Parse(input[i]);
                //결과값 개행없이 띄어쓰기하면서 출력
                Console.Write(result[i] + " ");
            }

        }
    }
}

'백준' 카테고리의 다른 글

백준 10988번 c#  (0) 2024.01.16
백준 2444번 c#  (0) 2024.01.15
백준 25083번 c#  (0) 2024.01.15
백준 11718번 c#  (0) 2024.01.15
백준 5622번 c#  (0) 2024.01.14