一家銀行計劃安裝一臺取款機,這種機器可以根據(jù)用戶要求吐出適當(dāng)金額的@現(xiàn)金,它用N種確定面額的鈔票,而且Dk面額的有nk張,例如:
N=3,n1=10,D1=100,n2=4,D2=50,n3=5,D3=10
意思是這臺機器有10張100@,4張50@,和5張10塊@.
為了可以根據(jù)要求支付現(xiàn)款,取款機應(yīng)該有一個程序來計算出最大金額,這個金額應(yīng)該小于等于取款機根據(jù)上面數(shù)據(jù)可以提供的金額.
@是取款機可以提供的貨幣形式,比如,@可以代表美員,歐元,英鎊等.
英語翻譯
英語翻譯
A Bank plans to install a machine for cash withdrawal.The machine is able to deliver appropriate @ bills for a requested cash amount.The machine uses exactly N distinct bill denominations,say Dk,k=1,N,and for each denomination Dk the machine has a supply of nk bills.For example,
N=3,n1=10,D1=100,n2=4,D2=50,n3=5,D3=10
means the machine has a supply of 10 bills of @100 each,4 bills of @50 each,and 5 bills of @10 each.
Call cash the requested amount of cash the machine should deliver and write a program that computes the maximum amount of cash less than or equal to cash that can be effectively delivered according to the available bill supply of the machine.
Notes:
@ is the symbol of the currency delivered by the machine.For instance,@ may stand for dollar,euro,pound etc.
補充....
三樓的再麻煩一下..
Input
The program input is from standard input.Each data set in the input stands for a particular transaction and has the format:
cash N n1 D1 n2 D2 ...nN DN
where 0
A Bank plans to install a machine for cash withdrawal.The machine is able to deliver appropriate @ bills for a requested cash amount.The machine uses exactly N distinct bill denominations,say Dk,k=1,N,and for each denomination Dk the machine has a supply of nk bills.For example,
N=3,n1=10,D1=100,n2=4,D2=50,n3=5,D3=10
means the machine has a supply of 10 bills of @100 each,4 bills of @50 each,and 5 bills of @10 each.
Call cash the requested amount of cash the machine should deliver and write a program that computes the maximum amount of cash less than or equal to cash that can be effectively delivered according to the available bill supply of the machine.
Notes:
@ is the symbol of the currency delivered by the machine.For instance,@ may stand for dollar,euro,pound etc.
補充....
三樓的再麻煩一下..
Input
The program input is from standard input.Each data set in the input stands for a particular transaction and has the format:
cash N n1 D1 n2 D2 ...nN DN
where 0
英語人氣:455 ℃時間:2019-10-08 08:14:48
優(yōu)質(zhì)解答
我來回答
類似推薦
猜你喜歡
- 1我在幕天席地的生涯中幕天席地什么意思
- 236.Do you think Tommy is ______ the truth?
- 3tall.old.young .strong.short.這些單詞的比較級
- 4近水樓臺先得月,向陽花木易為春是不是關(guān)于抒懷言志的詩句
- 5三角函數(shù)圖像 平移變換
- 6求下列各方程表示的圓的圓心坐標(biāo)和半徑長
- 7下列現(xiàn)象中屬于做功使物體內(nèi)能增加的是:A水蒸氣將壺蓋頂起 2用火爐給水加熱 3鋼條在水泥地上摩擦變熱 4用太陽能熱水器對水加熱
- 8一個兩位數(shù),它的十位上的數(shù)字比個位上的數(shù)字大4且這個兩位數(shù)比構(gòu)成它的兩個數(shù)碼之和的7倍還要大3.
- 9請問 據(jù)說,我在娘胎時,就“登臺唱戲”了——母親在臺上唱,我在她肚子里唱.引號.破折號作用是什么
- 10九年級上人教版語文書第24課
- 11一個物體從40m的高處自由下落,下落多少米后該物體的動能和重力勢能相等?
- 12尋求靜心的道家心法