-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7568 덩치
52 lines (41 loc) · 1.54 KB
/
7568 덩치
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
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
namespace beakjoon
{
class MainClass
{
public static void Main(string[] args)
{
Dictionary<int, Tuple<int, int>> keyValuePairs = new Dictionary<int, Tuple<int, int>>();
string peopleCount = Console.ReadLine();
for (int i = 0; i < Convert.ToInt16(peopleCount); i++)
{
string[] weightAndHeight = Console.ReadLine().Split(" ");
keyValuePairs.Add(i, new Tuple<int, int>(Convert.ToInt16(weightAndHeight[0]), Convert.ToInt16(weightAndHeight[1])));
}
List<Tuple<int, int>> rankTuple = new List<Tuple<int, int>>();
for (int i = 0; i < Convert.ToInt16(peopleCount); i++)
{
int upCount = 1;
for (int j = 0; j < Convert.ToInt16(peopleCount); j++)
{
if (i != j)
{
if(keyValuePairs[i].Item1 < keyValuePairs[j].Item1 && keyValuePairs[i].Item2 < keyValuePairs[j].Item2)
{
upCount++;
}
}
}
rankTuple.Add(new Tuple<int, int>(i, upCount));
}
List<int> result = new List<int>();
foreach (var eachRankTuple in rankTuple)
{
result.Add(eachRankTuple.Item2);
}
Console.WriteLine(String.Join(" ", result.ToArray()));
}
}
}