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();
}
}
}
'알고리즘 > 백준 BOJ' 카테고리의 다른 글
[ BOJ/C# ] 7576 토마토 (0) | 2023.10.10 |
---|---|
[ BOJ/C# ] 1012 유기농 배추 (0) | 2023.10.09 |
[ BOJ/C# ] 2805 나무 자르기 (0) | 2023.10.07 |
[ BOJ/C# ] 2579 계단 오르기 (0) | 2023.10.07 |
[ BOJ/C# ] 9375 패션왕 신해빈 (0) | 2023.10.05 |