알고리즘/백준 BOJ
[ BOJ/C# ] 7568 덩치
왹져박사
2023. 10. 9. 02:24
https://www.acmicpc.net/problem/7568
7568번: 덩치
우리는 사람의 덩치를 키와 몸무게, 이 두 개의 값으로 표현하여 그 등수를 매겨보려고 한다. 어떤 사람의 몸무게가 x kg이고 키가 y cm라면 이 사람의 덩치는 (x, y)로 표시된다. 두 사람 A 와 B의 덩
www.acmicpc.net
using System;
using System.ComponentModel;
using System.IO;
using System.Text;
namespace B7568
{
class Program
{
static void Main()
{
StreamReader sr = new StreamReader(Console.OpenStandardInput());
StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
StringBuilder sb = new StringBuilder();
int n = int.Parse(sr.ReadLine());
int[,] array = new int[n + 1, 2];
for(int i = 0; i < n; i++)
{
int[] xy = Array.ConvertAll(sr.ReadLine().Split(' '), int.Parse);
array[i, 0] = xy[0];
array[i, 1] = xy[1];
}
for(int i=0; i < n; i++)
{
int count = 1;
for(int j=0; j < n; j++)
{
if (array[i, 0] < array[j, 0] && array[i, 1] < array[j, 1])
count++;
}
sb.Append(count + " ");
}
sw.Write(sb);
sr.Close();
sw.Flush();
sw.Close();
}
}
}