Hit the Lottery

简介: Hit the Lottery

文章目录

一、Hit the Lottery

总结


一、Hit the Lottery

本题链接:Hit the Lottery


题目:

A. Hit the Lottery

time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

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?


Input

The first and only line of input contains a single integer n (1≤n≤109).


Output

Output the minimum number of bills that Allen could receive.


Examples

input

125

output

3

input

43

output

5

input

1000000000

output

10000000


Note

In the first sample case, Allen can withdraw this with a 100 dollar bill, a 20 dollar bill, and a 5 dollar bill. There is no way for Allen to receive 125 dollars in one or two bills.


In the second sample case, Allen can withdraw two 20 dollar bills and three 1 dollar bills.


In the third sample case, Allen can withdraw 100000000 (ten million!) 100 dollar bills.


本博客给出本题截图:

image.png

题意: 纸币有大有小,问最少可以用多少张纸币表示数字n

AC代码

#include <cstdio>
using namespace std;
int main()
{
    int a[5] = {1, 5, 10, 20, 100};
    int n;
    scanf("%d", &n);
    int res = 0;
    for (int i = 4; i >= 0; i -- )
    {
        int t = n / a[i];
        res += t;
        n -= a[i] * t;
    }
    printf("%d\n", res);
    return 0;
}

总结

水题,不解释


目录
相关文章
|
9月前
|
敏捷开发 搜索推荐
HIT REFRESH
HIT REFRESH
70 0
A. Hit the Lottery(贪心)
A. Hit the Lottery(贪心)
74 0
|
存储 Python
LeetCode 315. Count of Smaller Numbers After Self
给定一个整数数组 nums,按要求返回一个新数组 counts。数组 counts 有该性质: counts[i] 的值是 nums[i] 右侧小于 nums[i] 的元素的数量。
104 0
LeetCode 315. Count of Smaller Numbers After Self
|
存储 缓存 算法
Block Throttle - Low Limit
传统的 block throttle 的语义是,cgroup 不能超过用户配置的 IOPS/BPS,此时所有 cgroup 会自由竞争 IO 资源;那么其存在的问题就是,如果用户配置的 IOPS/BPS 过高,所有 cgroup 之间就会完全自由竞争 IO 资源,从而无法保证 QoS,而如果用户配置的 IOPS/BPS 过低,又无法充分发挥 block 设备的性能 Facebook 的 Shao
604 0
|
关系型数据库 Oracle
|
SQL Oracle 关系型数据库
|
Python
5.For loops
for 循环语句   在需要重复执行代码的时候,for循环常常被用到。我们可以让一行代码执行10次:   for i in range(1,11): print(i)   最后一个数字11是不包含在内的。
764 0