[백준] C# : 킹, 퀸, 룩, 비숍, 나이트, 폰 (3003번)

ssu_hyun·2022년 7월 17일
0

Data Structure & Algorithm

목록 보기
33/67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            string [] input = Console.ReadLine().Split();
            int [] s = { 1, 1, 2, 2, 2, 8 };
            for (int i=0; i<input.Length; i++)
            {
                s[i] -= int.Parse(input[i]);
            }
            foreach (int j in s)
            {
                Console.Write(j.ToString() + " ");
            }
        }
    }
}
  • 배열 출력
    • foreach
    • string[] strArray = new string[] { "abc", "def", "asd" };
       strArray.ToList().ForEach(Console.WriteLine);
       /*
       [출력]
       abc
       def
       asd
       */

0개의 댓글