QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB

#23934. ตัวเลขที่ปรากฏ

Statistics

โจทย์ปัญหา

กำหนดลำดับ $A = (A_1, A_2, \dots, A_N)$ ที่มีความยาว $N$ ซึ่งประกอบด้วยจำนวนเต็มตั้งแต่ $0$ ถึง $9$ จงแสดงจำนวนเต็มทั้งหมดที่ปรากฏอย่างน้อย $1$ ครั้งในลำดับ $A$ โดยเรียงจากน้อยไปมาก

ข้อจำกัด

  • $1 \le N \le 100$
  • $0 \le A_i \le 9$ ($1 \le i \le N$)
  • ค่าที่รับเข้ามาทั้งหมดเป็นจำนวนเต็ม

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะกำหนดให้ในรูปแบบต่อไปนี้:

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

ข้อมูลส่งออก

จงแสดงจำนวนเต็มทั้งหมดที่ปรากฏอย่างน้อย $1$ ครั้งในลำดับ $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

ตัวอย่างข้อมูลนำเข้า 2

3
9 9 9

ตัวอย่างข้อมูลส่งออก 2

9
  • จำนวนเต็มที่ปรากฏอย่างน้อย $1$ ครั้งมีเพียง $9$ เท่านั้น ดังนั้นจึงแสดงผลออกมาเป็น $1$ บรรทัด

ตัวอย่างที่ 3

ตัวอย่างข้อมูลนำเข้า 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.