QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB

#23925. 馬拉松比賽

Statistics

題目描述

JOI 高中有 $N$ 名學生,編號為 $1$ 到 $N$。

上個月 JOI 高中舉辦了馬拉松比賽,全體學生都參加了比賽。學生 $i$($1 \le i \le N$)的紀錄為 $A_i$ 分鐘。

請計算每名學生在馬拉松比賽中的名次。其中,學生 $i$($1 \le i \le N$)的名次按(紀錄小於 $A_i$ 分鐘的學生人數)$+ 1$ 計算。

限制條件

  • $1 \le N \le 100$。
  • $1 \le A_i \le 1000$($1 \le i \le N$)。
  • 輸入的所有值皆為整數。

輸入格式

輸入以如下格式給出:

$N$ $A_1 \ A_2 \ \dots \ A_N$

輸出格式

輸出 $N$ 行。第 $i$ 行($1 \le i \le N$)輸出學生 $i$ 的名次。

範例

範例輸入 1

3
44 42 69

範例輸出 1

2
1
3
  • 學生 $1$ 的紀錄為 $44$ 分鐘。紀錄小於 $44$ 分鐘的學生有 $1$ 人,故學生 $1$ 的名次為第 $2$ 名。因此,第 $1$ 行輸出 $2$。
  • 學生 $2$ 的紀錄為 $42$ 分鐘。沒有紀錄小於 $42$ 分鐘的學生,故學生 $2$ 的名次為第 $1$ 名。因此,第 $2$ 行輸出 $1$。
  • 學生 $3$ 的紀錄為 $69$ 分鐘。紀錄小於 $69$ 分鐘的學生有 $2$ 人,故學生 $3$ 的名次為第 $3$ 名。因此,第 $3$ 行輸出 $3$。

範例輸入 2

4
40 60 40 60

範例輸出 2

1
3
1
3
  • 學生 $1$ 的紀錄為 $40$ 分鐘。沒有紀錄小於 $40$ 分鐘的學生,故學生 $1$ 的名次為第 $1$ 名。因此,第 $1$ 行輸出 $1$。
  • 學生 $2$ 的紀錄為 $60$ 分鐘。紀錄小於 $60$ 分鐘的學生有 $2$ 人,故學生 $2$ 的名次為第 $3$ 名。因此,第 $2$ 行輸出 $3$。
  • 學生 $3$ 的紀錄為 $40$ 分鐘。沒有紀錄小於 $40$ 分鐘的學生,故學生 $3$ 的名次為第 $1$ 名。因此,第 $3$ 行輸出 $1$。
  • 學生 $4$ 的紀錄為 $60$ 分鐘。紀錄小於 $60$ 分鐘的學生有 $2$ 人,故學生 $4$ 的名次為第 $3$ 名。因此,第 $4$ 行輸出 $3$。

範例輸入 3

10
766 152 595 926 663 509 368 595 175 622

範例輸出 3

9
1
5
10
8
4
3
5
2
7

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.