c122. 00443 - Humble Numbers
Tags :
Accepted rate : 460人/523人 ( 88% ) [非即時]
評分方式:
Strictly

最近更新 : 2015-08-28 15:13

Content

如果一個數字它的質因數只有2,3,5或7則我們稱這個數字為Humble number。下列數字代表前20個Humble numbers:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27,...

Input

輸入包含多個測試資料。每一個測試資料包含一個整數n,1<= n <= 5842。當n=0時代表輸入結束。

Output

對每個測試資料必須輸出一行"The nth humble number is number."。對每個nth你必須依照n值不同輸出正確的序數"st", "nd", "rd", 或"th"。請參考sample output。

Sample Input #1
1
2
3
4
11
12
13
21
22
23
100
1000
5842
0
Sample Output #1
The 1st humble number is 1.
The 2nd humble number is 2.
The 3rd humble number is 3.
The 4th humble number is 4.
The 11th humble number is 12.
The 12th humble number is 14.
The 13th humble number is 15.
The 21st humble number is 28.
The 22nd humble number is 30.
The 23rd humble number is 32.
The 100th humble number is 450.
The 1000th humble number is 385875.
The 5842nd humble number is 2000000000.
測資資訊:
記憶體限制: 512 MB
公開 測資點#0 (100%): 1.0s , <1M
Hint :

* Luck 貓翻譯

Tags:
出處:
UVa443


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」