当前位置:网站首页>2021-3-19-字节-面值
2021-3-19-字节-面值
2022-07-17 00:02:00 【茴薏】
题目描述:
Z国的货币系统包含面值1元、4元、16元、64元共计4种硬币,以及面值1024元的纸币。现在小Y使用1024元的纸币购买了一件价值为的商品,请问最少他会收到多少硬币?
输入描述:
一行,包含一个数N。
输出描述:
一行,包含一个数,表示最少收到的硬币数。
输入
200
输出
17
说明
花200,需要找零824块,找12个64元硬币,3个16元硬币,2个4元硬币即可。
#include <iostream>
using namespace std;
int main()
{
int num;
while (cin >> num)
{
int cash = 1024 - num;
int num_64 = cash / 64;
int num_16 = cash % 64 / 16;
int num_4 = cash % 64 % 16 / 4;
int num_1 = cash % 64 % 16 % 4;
cout << num_64 + num_16 + num_4 + num_1 << endl;
}
return 0;
}
边栏推荐
- [Shader implémente l'effet Wave Shader chapitre 1]
- 【MD5】快速实现MD5加密解密(盐值)
- [deep learning] (II) basic learning notes of deep learning
- PageHelper网图形
- Flowable workflow (flowable database table structure)
- 【着色器实现Wave效果_Shader效果第一篇】
- QT opens external program and embeds QT interface
- [daily training] sword finger offer II 041 Average value of sliding window
- 【JDBC】批处理思路
- Switch and router technology: Integrated Experiment of hot backup routing protocols HSRP, HSRP and spvstp
猜你喜欢
随机推荐
Build your own blog system website in one hour
【着色器实现Wave效果_Shader效果第一篇】
[Shader implémente l'effet Wave Shader chapitre 1]
mysql数据表查询
12. Integer to Roman numerals ●●
2022.7.1
Computer Graphics From Scratch - Chapter 3
P1321 单词覆盖还原【入门】
Solve the garbled code when inserting Chinese values in MySQL database
JSP basic grammar experiment
IDEA开发Servlet项目 如何右键创建servlet
[JDBC] batch processing idea
Common linked list questions and their go implementation
Performance management in digital intelligence era: reality and future
“husky install“ command already exists in prepare script, skipping./Users/982471938qq.com/Desktop
Based on yolov5 PT model is converted to Engine model, accelerated by deepstream, can be transmitted in real time with multiple cameras, using NVIDIA's Xavier board (precision 1)
cli和vite通过代理实现跨域
PHP upload pictures
UVA11362 Phone List 题解
FactoryBean 使用场景


![[deep learning] (II) basic learning notes of deep learning](/img/fe/99c56e2b7e8d6807ece120e0ee1ceb.png)





