英语翻译
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
人气:157 ℃ 时间:2019-10-08 08:14:48
解答
一家银行计划安装一台取款机,这种机器可以根据用户要求吐出适当金额的@现金,它用N种确定面额的钞票,而且Dk面额的有nk张,例如:
N=3,n1=10,D1=100,n2=4,D2=50,n3=5,D3=10
意思是这台机器有10张100@,4张50@,和5张10块@.
为了可以根据要求支付现款,取款机应该有一个程序来计算出最大金额,这个金额应该小于等于取款机根据上面数据可以提供的金额.
@是取款机可以提供的货币形式,比如,@可以代表美员,欧元,英镑等.
推荐
- 英语翻译
- 英语翻译
- 英语翻译
- 英语翻译
- 英语翻译
- n是正整数,求证13^2n-1是168的倍数
- 0,1,3,8,22,63 ( ) 根据前面的数字推出括号里的数
- 一瓶水连瓶重2分之3千克,喝了一半后,连瓶重8分之7千克,瓶重多少千克,水重多少
猜你喜欢
- 1x2x3x4x……xn的积的末尾正好有12个0,n的最小值是多少?最大值是多少?
- 梯形的中位线长为10CM,高为4CM,则此梯形的面积为
- 水在高温下、在电磁波的作用下、是可以分裂成氢和氧的.分裂成氢和氧就可以燃烧?
- 为什么富有的人更富有,贫穷的人更贫穷?
- 甲数比乙数多30,甲数与乙数的比是9:4,甲数是( ),乙数是( ).
- 夸父逐日的字词解释
- 已知f(x)为奇函数,g(x)为偶函数,且满足f(x)+g(x)=x²+x+1,求f(x)和g(x)
- 在三相电源的三角形连接中,若三相电动势对称,他们的向量之和等于 理想电压源与理想电流源之间( ) 进行等效