五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

CF 996A - Hit the Lottery

2023-06-24 09:35 作者:您是打尖兒還是住店呢  | 我要投稿

Allen has a LOT of money. He has n dollars in the bank. For security reasons, he wants to withdraw it in cash (we will not disclose the reasons here). The denominations for dollar bills are 1, 5, 10, 20, 100. What is the minimum number of bills Allen could receive after withdrawing his entire balance?

艾倫有很多錢。 他在銀行有 n 美元。 出于安全考慮,他想以現(xiàn)金的方式提?。ㄎ覀冞@里不會(huì)透露原因)。 美元鈔票的面額為 1、5、10、20、100。艾倫提取全部余額后最少可以收到多少?gòu)堚n票?

------------------------------------------------------------

看來(lái)Allen的錢并不多啊。。。

其實(shí)就是取余,依次循環(huán)即可;;

下面是代碼:

import java.util.Scanner;


public class A996 {

? ? public static void main(String[] args) {

? ? ? ? Scanner sc=new Scanner(System.in);

? ? ? ? int n=sc.nextInt();

? ? ? ? sc.close();

? ? ? ? int cnt=0;

? ? ? ? int[]arr={100,20,10,5,1};

? ? ? ? int i=0;

? ? ? ? while(n>0&&i<5){

? ? ? ? ? ? cnt+=n/arr[i];

? ? ? ? ? ? n=n%arr[i];

? ? ? ? ? ? i++;

? ? ? ? }

? ? ? ? System.out.println(cnt);

? ? }

}


沒(méi)錯(cuò)完全是湊字?jǐn)?shù)的。不好意思。

CF 996A - Hit the Lottery的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
咸宁市| 崇文区| 马关县| 德江县| 长沙县| 丰台区| 吴堡县| 横山县| 扎兰屯市| 合水县| 昂仁县| 灵山县| 贵定县| 安吉县| 江油市| 邳州市| 昭苏县| 上高县| 聊城市| 曲阜市| 阜新市| 乌兰县| 宜良县| 沙湾县| 瑞丽市| 凯里市| 镇坪县| 五家渠市| 文水县| 九龙坡区| 保靖县| 昌乐县| 开原市| 沅江市| 芜湖市| 武平县| 定兴县| 汶上县| 潞城市| 仙桃市| 平顺县|