題目:https://toi-reg.csie.ntnu.edu.tw/question/201903/B3-BigEater(Q).pdf
Wayne 是個饕客兼大胃王,而他最喜歡的食物就是麥噹噹的蘋果派和玉米濃湯,因此他決定要把口袋裡所有錢通通拿來吃 32 元的蘋果派和 55 元的大杯玉米濃湯。他最愛的吃法就是蘋果派與玉米濃湯交替著吃,也就是說若無法形成交替則不繼續進食,這是 Wayne 的堅持。請你幫忙寫程式列印出他大吃大喝的過程。
輸入總共有三個整數,以空白隔開。第一個整數 N ( 0 ≤ N ≤ 500 )為 Wayne 總共帶了多少錢,第二個整數 M ( 0 < M ≤ 60 )為他每隔幾分鐘進食一次,第三個 整數 K = 0 的話代表從蘋果派開始吃,K = 1 的話則代表從玉米濃湯開始。
每筆輸出包含經過時間、吃的食物與剩餘金額,請參考範例輸出。
65 5 0
0: Wayne eats an Apple pie, and now he has 33 dollars.
143 18 1
0: Wayne drinks a Corn soup, and now he has 88 dollars. 18: Wayne eats an Apple pie, and now he has 56 dollars. 36: Wayne drinks a Corn soup, and now he has 1 dollar.
55 1 1
0: Wayne drinks a Corn soup, and now he doesn't have money.
31 10 0
Wayne can't eat and drink.
ID | User | Problem | Subject | Hit | Post Date |
21151 | fire5386 (becaidorz) | e969 | 1603 | 2020-04-20 19:37 | |
37416 |
|
e969 | 31 | 2023-09-07 14:32 | |
35028 | wubaie (小億) | e969 | 89 | 2023-05-03 13:45 | |
30657 |
|
e969 | 427 | 2022-06-03 22:09 | |
21032 | Easonsfriend (去寫./Problems?ow...) | e969 | 1156 | 2020-04-03 17:25 |