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
}
}
}
'Algorithm > BOJ' 카테고리의 다른 글
C# 문자열)[BOJ] 10173 니모를 찾아서 (0) | 2023.01.12 |
---|---|
C# 문자열)[BOJ] 4458 첫 글자를 대문자로 (0) | 2023.01.12 |
C# 문자열) [BOJ] 9086 문자열 (0) | 2023.01.12 |
C# 큐) [BOJ] 라우터 15828 (0) | 2023.01.11 |
C# 문자열) [BOJ] 괄호 9012 (0) | 2023.01.11 |