QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB

#23934. Appearing Numbers

Statistics

問題文

0 以上 9 以下の整数からなる,長さ N の数列 A = (A1, A2, …, AN) が与えられる.数列 A に少なくとも 1 回現れている整数をすべて,小さい順に出力せよ.

制約

  • 1 ≦ N ≦ 100.
  • 0 ≦ Ai≦ 9 (1 ≦ i ≦ N).
  • 入力される値はすべて整数である.

入力

入力は以下の形式で与えられる.
N
A1 A2 … AN

出力

数列 A に少なくとも 1 回現れている整数をすべて,小さい順に改行区切りで出力せよ.

結果以外は何も出力しないこと.(入力を促す文章なども出力しないこと.)

解答形式については,練習問題やその解答例 を参考にしても良い.


入力例 1

8
2 0 2 3 0 9 1 6

出力例 1

0
1
2
3
6
9
  • 少なくとも 1 回現れている整数を小さい順に並べると 0, 1, 2, 3, 6, 9 であるので,これらを 6 行で出力する.

入力例 2

3
9 9 9

出力例 2

9
  • 少なくとも 1 回現れている整数は 9 のみであるので,これを 1 行で出力する.

入力例 3

10
3 1 4 1 5 9 2 6 5 3

出力例 3

1
2
3
4
5
6
9
  • 少なくとも 1 回現れている整数を小さい順に並べると 1, 2, 3, 4, 5, 6, 9 であるので,これらを 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.