C#/알고리즘
백준#3047 - ABC
McRobbin
2020. 4. 21. 14:59
https://www.acmicpc.net/problem/3047
3047번: ABC
문제 세 수 A, B, C가 주어진다. A는 B보다 작고, B는 C보다 작다. 세 수 A, B, C가 주어졌을 때, 입력에서 주어진 순서대로 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 세 수 A, B, C가 주어진다. 하지만, 순서는 A, B, C가 아닐 수도 있다. 세 수는 100보다 작거나 같은 자연수이다. 둘째 줄에는 A, B, C로 이루어진 세 글자가 주어지며, 이 순서대로 출력하면 된다. 출력 주어진 세 수를 주어진 출력 순서대로 출력하면
www.acmicpc.net
정렬 문제로 분류된 3047 - ABC 입니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _3047
{
class Program
{
static void Main(string[] args)
{
string[] input = Console.ReadLine().Split(' ');
string charInput = Console.ReadLine();
List<int> list = new List<int>();
foreach (string str in input)
list.Add(int.Parse(str));
Dictionary<string, int> dict = new Dictionary<string, int>();
{
int num;
dict.TryGetValue(charInput.Substring(i, 1), out num);
Console.Write("{0} ", num);
}
int last;
dict.TryGetValue(charInput.Substring(2, 1), out last);
Console.Write(last);
}
}
}
|
설명은 생략합니다...