問題一覧 > 通常問題

No.564 Height Order

レベル : / AI推定難易度 : 120 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 590
作問者 : makonagix / テスター : はむこ
お気に入りにしたユーザー ProblemId : 1873 / 自分の提出
問題文最終更新日: 2026-06-28 19:30:38
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 173 (順位表) の他の問題:

Problem Statement

Nama-kun, whose height is $H$[cm], became curious about where his height ranks in his class.
Nama-kun's class has $N$ students, including Nama-kun.
The heights of the other students are $H_i$[cm] ($1≦i≦N-1$).
Write a program that outputs the rank of Nama-kun's height.

Input

$H$ $N$
$H_1$
$H_2$
...
$H_{N-1}$

The input consists of $N$ lines.
The $1$st line contains Nama-kun's height $H$ ($1≦H≦1000$) and the number of students in the class $N$ ($2≦N≦100$), both integers, separated by a space.
The $i$-th of the following $N-1$ lines ($1≦i≦N-1$) contains an integer $H_i$ ($1≦H_i≦1000$), the height of a classmate other than Nama-kun.
$H$ and $H_i$ ($1≦i≦N-1$) are all distinct.

Output

Output the position of Nama-kun's height in the class, counted from the tallest, and

  • if its ones digit is $1$, append st to the end.
  • if its ones digit is $2$, append nd to the end.
  • if its ones digit is $3$, append rd to the end.
  • otherwise, append th to the end.
This may differ from real-world notation.
Print a newline at the end.

Sample

Sample 1
Input
157 4
178
164
155
Output
3rd

Nama-kun's height is $157$[cm] and the other students' heights are $178$[cm], $164$[cm], and $155$[cm], so Nama-kun is the $3$rd tallest.

Sample 2
Input
157 4
160
175
168
Output
4th

The other students' heights are not necessarily sorted already.

Sample 3
Input
188 10
146
178
160
165
182
174
2
166
186
Output
1st

Nama-kun is the tallest.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。