- 最後登錄
- 2024-3-25
- 在線時間
- 76 小時
- 註冊時間
- 2008-8-30
- 閱讀權限
- 20
- 精華
- 0
- UID
- 4880098
- 帖子
- 97
- 積分
- -1 點
- 潛水值
- 12053 米
| 若新密碼無法使用,可能是數據未更新。請使用舊密碼看看。 Q1: Let Me Count The Ways經過在百貨公司的一場血拼之後,小梅發現她身上的零錢共有17 分(cent,美金貨幣單位,其他貨幣及面值請參考下方紅字部分),分別是1 個dime,1 個nickel,以及2 個penny。隔天,小梅去便利商店買完東西後發現她身上的零錢恰好又是17分,這次是2 個nickel 及7 個penny。小梅就在想,有幾種硬幣的組合可能湊成17分呢?經過仔細算算之後,發現共有6 種。你的問題就是:給一個金額,請你回答共有多少種硬幣組合的方式。p.s 美國的零錢共有以下幾種硬幣以及其面值:‧ penny, 1 cent‧ nickel, 5 cents‧ dime, 10 cents‧ quarter, 25 cents‧ half-dollar, 50 centsInput每組測試資料 1列,有1個整數n(0 <=n <=30000),代表零錢的總金額。Output對每組測試資料請輸出共有多少種硬幣組合方式。輸出格式為以下 2 種其中之一。‧ There are m ways to produce n centschange.‧ There is only 1 way to produce n centschange.Sample input17114Sample OutputThere are 6 ways to produce 17 cents change.There are 4 ways to produce 11 cents change.Thereis only 1 way to produce 4 cents change.Q2:Kindergarten Counting Game算一算每行有幾個字(word)。Word 的定義是連續的字元(letter: A~Za~z)所組成的字。Input測試資料每筆一行,每行至少有一個字。Output輸出每一行的 word 數。Sample inputMeep Meep!I tot I taw a putty tat.I did! I did! I did taw a putty tat.Shsssssssssh ... I am hunting wabbits. HehHeh Heh Heh ...Sample Output27109 ... |
|