QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100

#23904. 稀有數字

Statistics

題目描述

給定一個長度為 $N$ 的整數序列 $A = (A_1, A_2, \dots, A_N)$。

在 $A$ 中出現的整數裡,請輸出出現次數最少的整數。但若有多個這樣的整數,請輸出其中最小的整數。

輸入格式

輸入以以下格式由標準輸入給出:

N
A_1 A_2 ... A_N

輸出格式

在 $A$ 中出現的整數裡,請輸出出現次數最少的整數。但若有多個這樣的整數,請輸出其中最小的整數。

範例

範例 1

輸入
3
3 4 3
輸出
4
解釋

$A$ 中包含 $3$ 共 $2$ 個,$4$ 共 $1$ 個。除 $3, 4$ 以外的整數沒有出現。其中 $4$ 的出現次數最少,因此輸出 $4$。

範例 2

輸入
5
4 4 8 2 5
輸出
2
解釋

$A$ 中包含 $2$ 共 $1$ 個,$4$ 共 $2$ 個,$5$ 共 $1$ 個,$8$ 共 $1$ 個。除 $2, 4, 5, 8$ 以外的整數沒有出現。其中出現次數最少的整數為 $2, 5, 8$。因此輸出 $2, 5, 8$ 中最小的 $2$。

範例 3

輸入
8
8 8 7 7 6 6 5 5
輸出
5

數據範圍與提示

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

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.