Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 깃허브 데스크탑 합치기
- m585
- networkobject
- m585 수리
- M590
- 유니티 해상도 설정
- stateauthority
- nav거리
- navigation
- 유니티 브랜치 merge
- m590 수리
- unity merge
- unity git
- 유니티 해상도 변경
- Github DeskTop Merge
- 유니티 해상도
- 유니티
- unity 병합
- 몬스터
- networkbehaviourid
- Unity
- 유니티 머지
- 오브젝트 깜빡임
- githubdesktopmerge
- 깃허브 데스크탑 병합
- NavMesh
- 유니티 합치기
- networkobject.networkid
- nav오브젝트사이거리
Archives
- Today
- Total
집게사장의 꿈
백준 C# 10814 나이순 정렬 본문

문제
나이 순으로 정렬하되, 나이가 같을 경우 먼저 들어온 순서로 정렬
나이 범위 1<= N <= 200
해결
최대 200일 경우 딕셔너리에 저장하는 방법이 정렬이 편리하다고 생각했다.
internal class 나이순정렬10814
{
static void Main(string[] args)
{
string input()=> Console.ReadLine();
int iter = int.Parse(input());
SortedDictionary<int, List<string>> dic = new SortedDictionary<int, List<string>>();
for(int i = 0; i < iter; i++)
{
string[] str = input().Split();
int age = int.Parse(str[0]);
string name = str[1];
if (dic.ContainsKey(age))
{
dic[age].Add(name);
}
else
{
dic[age] = new List<string>
{
name
};
}
}
foreach(var d in dic)
{
foreach(string name in d.Value)
{
Console.WriteLine($"{d.Key} {name}");
}
}
}
}
'기타 > 백준' 카테고리의 다른 글
백준 C# 1018 체스판 다시 색칠하기 (0) | 2024.08.28 |
---|---|
백준 C# 좌표정렬하기 11650 (0) | 2024.08.28 |
백준 C# 평범한배낭 12865 (0) | 2024.08.15 |
백준 C# LCS 9251 (1) | 2024.08.15 |
백준 C# 1916 최소비용 구하기 (0) | 2024.08.10 |