https://www.acmicpc.net/problem/2711

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Study11
{
    class App
    {
        public App()
        {
            //boj 2711 오타맨 고창영 
            Dictionary<int, string> dic = new Dictionary<int, string>(){
                { 4, "MISSPELL" },
                { 1, "PROGRAMMING" },
                { 7, "CONTEST" },
                { 3, "BALLOON" },
            };

            //여기서부터 작성 
            foreach (KeyValuePair<int, string> kvp in dic)//딕셔너리의 키와 밸류값
            {              
                if (kvp.Key == 4)
                {
                    for (int i = 0; i < kvp.Value.Length; i++)
                    {
                        if (i == kvp.Key - 1)
                        {
                            continue;
                        }
                        else
                        {
                            Console.Write(kvp.Value[i]);
                        }
                    }
                    Console.WriteLine();
                }
                if (kvp.Key == 1)
                {
                    for (int i = 0; i < kvp.Value.Length; i++)
                    {
                        if (i == kvp.Key - 1)
                        {
                            continue;
                        }
                        else
                        {
                            Console.Write(kvp.Value[i]);
                        }
                    }
                    Console.WriteLine();
                }
                if (kvp.Key == 7)
                {
                    for (int i = 0; i < kvp.Value.Length; i++)
                    {
                        if (i == kvp.Key - 1)
                        {
                            continue;
                        }
                        else
                        {
                            Console.Write(kvp.Value[i]);
                        }
                    }
                    Console.WriteLine();
                }
                if (kvp.Key == 3)
                {
                    for (int i = 0; i < kvp.Value.Length; i++)
                    {
                        if (i == kvp.Key - 1)
                        {
                            continue;
                        }
                        else
                        {
                            Console.Write(kvp.Value[i]);
                        }
                    }
                    Console.WriteLine();
                }

            }


            //출력 
            //MISPELL
            //ROGRAMMING
            //CONTES
            //BALOON

        }
    }
}

+ Recent posts