Algorithm/BOJ
[BOJ] 2711 오타맨 고창영
Bueong_E
2023. 1. 12. 15:19
반응형
SMALL
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> index in dic) //Dictinary의 인덱스를 확인
{
if(index.Key == 4) //키값에 따라 if문 실행
{
for(int i =0; i < index.Value.Length; i++)
{
if (i == index.Key - 1) continue;
else
{
Console.Write("{0}", index.Value[i]);
}
}
Console.WriteLine();
}
if (index.Key == 1)
{
for (int i = 0; i < index.Value.Length; i++)
{
if (i == index.Key - 1) continue;
else
{
Console.Write("{0}", index.Value[i]); }
}
Console.WriteLine();
}
if (index.Key == 7)
{
for (int i = 0; i < index.Value.Length; i++)
{
if (i == index.Key - 1) continue;
else
{
Console.Write("{0}", index.Value[i]); }
}
Console.WriteLine();
}
if (index.Key == 3)
{
for (int i = 0; i < index.Value.Length; i++)
{
if (i == index.Key - 1) continue;
else
{
Console.Write("{0}", index.Value[i]); }
}
Console.WriteLine();
}
}
//출력
//MISPELL
//ROGRAMMING
//CONTES
//BALOON
}
}
}
결과물
반응형
LIST