五月天青色头像情侣网名,国产亚洲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ó)家法律
于田县| 东平县| 封开县| 综艺| 康平县| 金溪县| 武宁县| 民权县| 阿勒泰市| 饶河县| 长海县| 夏津县| 井研县| 伊通| 鹿泉市| 庆安县| 固阳县| 无为县| 文水县| 通化县| 兴化市| 富蕴县| 临汾市| 德惠市| 扎兰屯市| 精河县| 阿克陶县| 台前县| 峡江县| 西宁市| 个旧市| 崇州市| 灵川县| 广丰县| 中牟县| 襄汾县| 河津市| 普定县| 偃师市| 奉化市| 博白县|