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 |
Tags
- 오브젝트 깜빡임
- networkobject.networkid
- unity merge
- githubdesktopmerge
- 유니티 해상도 변경
- nav오브젝트사이거리
- navigation
- m590 수리
- Unity
- 깃허브 데스크탑 합치기
- unity git
- stateauthority
- networkbehaviourid
- 유니티 머지
- Github DeskTop Merge
- M590
- m585
- 유니티
- m585 수리
- 유니티 합치기
- 깃허브 데스크탑 병합
- 유니티 브랜치 merge
- 유니티 해상도
- unity 병합
- 유니티 해상도 설정
- nav거리
- 몬스터
- networkobject
- NavMesh
Archives
- Today
- Total
집게사장의 꿈
백준 C# 좌표정렬하기 11650 본문
문제
x, y 값이 주어질 때, 첫번째로 x를 오름차순으로 정렬하고 x값이 같을 경우 y의 값으로 오름차순으로 정렬하라
해결
OrderBy와 ThenBy 를 활용한 간단한 정렬
internal class 좌표정렬하기11650
{
static void Main(string[] args)
{
string[] input(StreamReader s) => s.ReadLine().Split();
List<(int x, int y)> list = new List<(int x, int y)>();
using (StreamReader sr = new StreamReader(Console.OpenStandardInput()))
{
int iter = int.Parse(input(sr)[0]);
while (iter > 0)
{
iter--;
int[] arr = Array.ConvertAll(input(sr),int.Parse);
list.Add((arr[0], arr[1]));
}
list = list.OrderBy(x => x.x).ThenBy(x => x.y).ToList();
}
StringBuilder sb = new StringBuilder();
foreach(var a in list)
{
sb.AppendLine($"{a.x} {a.y}");
}
Console.WriteLine(sb);
}
}
'기타 > 백준' 카테고리의 다른 글
백준 C# 1018 체스판 다시 색칠하기 (0) | 2024.08.28 |
---|---|
백준 C# 10814 나이순 정렬 (0) | 2024.08.28 |
백준 C# 평범한배낭 12865 (0) | 2024.08.15 |
백준 C# LCS 9251 (1) | 2024.08.15 |
백준 C# 1916 최소비용 구하기 (0) | 2024.08.10 |