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;
}

总结

水题,不解释


目录
相关文章
|
6月前
|
敏捷开发 搜索推荐
HIT REFRESH
HIT REFRESH
50 0
|
缓存 数据可视化
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
210 0
|
存储 缓存 算法
Block Throttle - Low Limit
传统的 block throttle 的语义是,cgroup 不能超过用户配置的 IOPS/BPS,此时所有 cgroup 会自由竞争 IO 资源;那么其存在的问题就是,如果用户配置的 IOPS/BPS 过高,所有 cgroup 之间就会完全自由竞争 IO 资源,从而无法保证 QoS,而如果用户配置的 IOPS/BPS 过低,又无法充分发挥 block 设备的性能 Facebook 的 Shao
546 0
|
关系型数据库 Oracle
|
SQL Oracle 关系型数据库
|
缓存 Oracle 关系型数据库
is not eligible for getting processed by all BeanPostProcessors
BeanPostProcessor是控制Bean初始化开始和初始化结束的接口。换句话说实现BeanPostProcessor的bean会在其他bean初始化之前完成,BeanPostProcessor会通过接口方法检查其他类型的Bean并做处理。
8740 0