Lotto Betting


Submit solution

Points: 20
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type

題目說明

<1124檢定考題>

請設計一個大樂透投注程式,程式每次可投注一組大樂透。
一組大樂透包含 6 個投注號碼,每 1 個號碼需介於 1-48 之間。
由鍵盤輸入 6 個投注號碼,投注號碼時必須符合:
(1) 號碼必須為介於 1~48 的正整數,並且號碼不得與之前輸入的號碼重複,否則螢幕上輸出「error」。
(2) 輸入 6 個不同號碼後即完成投注。
(3) 必須將所投注之 6 個號碼由小至大排列好並由螢幕輸出。

輸入

由鍵盤輸入 6 個投注號碼,投注號碼時必須符合:

  • 號碼必須為介於 1~48 的正整數,並且號碼不得與之前輸入的號碼重複,否則螢幕上輸出「error」。
  • 輸入 6 個不同號碼後即完成投注。

輸出

將所投注之 6 個號碼由小至大排列好並由螢幕輸出。

sample input1

14 25 32 35 16 26

sample output1

14 16 25 26 32 35

sample input2

14 16 14 17 44 48

sample output2

error

sample input3

7 20 15 54 12 8

sample output3

error

Comments

There are no comments at the moment.