TopCoder

User's AC Ratio

100.0% (2/2)

Submission's AC Ratio

100.0% (2/2)

Tags

Description

大部分的人第一次學習的排序演算法是 Bubble Sort,請大家使用巢狀迴圈,實做 Bubble Sort 的演算法。

Input Format

第一行輸入一個正整數 $n$,代表接下來會有幾個整數要你排序。
第二行輸入這 $n$ 個整數,數字之間以空白分隔。

  • $1 \leq n \leq 1000$
  • 所有要排序的數字都在 int 範圍內

Output Format

輸出排序後的結果。

Sample Input 1

10
0 11 22 33 55 -66 77 99 88 44

Sample Output 1

-66 0 11 22 33 44 55 77 88 99

Sample Input 2

1
13

Sample Output 2

13

Sample Input 3

5
73 -65 87 87 87

Sample Output 3

-65 73 87 87 87

Hints

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~16 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 524288 65536 1 2
1 1000 524288 65536 1 2
2 1000 524288 65536 1 2
3 1000 524288 65536 2
4 1000 524288 65536 2
5 1000 524288 65536 2
6 1000 524288 65536 2
7 1000 524288 65536 2
8 1000 524288 65536 2
9 1000 524288 65536 2
10 1000 524288 65536 2
11 1000 524288 65536 2
12 1000 524288 65536 2
13 1000 524288 65536 2
14 1000 524288 65536 2
15 1000 524288 65536 2
16 1000 524288 65536 2