QOJ.ac

QOJ

时间限制: 2 s 内存限制: 1024 MB 总分: 100

#23904. Rare Number

统计

問題文

長さ $N$ の整数列 $A = (A_{1}, A_{2}, …, A_{N})$ が与えられる.

$A$ に出現する整数のうち,出現回数が最小である整数を出力せよ.ただし,そのような整数が複数考えられる場合は,考えられる整数のうち最も小さい整数を出力せよ.

制約

  • $1 ≦ N ≦ 100$.
  • $1 ≦ A_{i} ≦ 2000$ ($1 ≦ i ≦ N$).
  • 入力される値はすべて整数である.

入力

入力は以下の形式で標準入力から与えられる.
$N$
$A_{1}$ $A_{2}$ $…$ $A_{N}$

出力

$A$ に出現する整数のうち,出現回数が最小である整数を出力せよ.ただし,そのような整数が複数考えられる場合は,考えられる整数のうち最も小さい整数を出力せよ.


入力例 1

3
3 4 3

出力例 1

4

$A$ には $3$ が $2$ 回,$4$ が $1$ 回出現する.$3, 4$ 以外の整数は出現しない.このうち,$4$ の出現回数が最小であるため,$4$ を出力する.


入力例 2

5
4 4 8 2 5

出力例 2

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

出力例 3

5

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.