当前位置:网站首页>-钞票兑换-
-钞票兑换-
2022-08-03 05:10:00 【-JMY-】
题目描述
将任意给定的整百元钞票,兑换成10元、20元、50元小钞票形式。输出兑换方案总数。
输入
输入需要兑换的钞票总数n。
输出
输出方案总数。
样例输入
100
样例输出
10
提示
方案序号:10元张数 20元张数 50元张数 (1)0 0 2(2)0 5 0 (3)1 2 1 (4)2 4 0 (5)3 1 1 (6)4 3 0 (7)5 0 1 (8)6 2 0 (9)8 1 0
(10)10 0 0
参考代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,s=0;
scanf("%d",&n);
for(int i=0;i<=n/10;i++){
for(int j=0;j<=n/20;j++){
if((n-i*10-j*20)%50==0&&n-i*10-j*20>=0)
s++;
}
}
printf("%d",s);
}
边栏推荐
- 信息编码、存储压缩与密码学
- 【转】最小描述长度准则MDL(Minimun Description Length)
- 第三次HarmonyOS培训
- Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
- 数字孪生园区场景中的坐标知识
- Redis6学习笔记
- Flask Web 报错:
- 阿里云对象存储oss私有桶生成链接
- Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
- 13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence
猜你喜欢

shell script loop statement

typescript42-readonly修饰符
2017-06-11 Padavan 完美适配newifi mini【adbyby+SS+KP ...】youku L1 /小米mini

Exception(异常) 和 Error(错误)区别解析

flask 面试题 问题

idea使用@Autowired注解爆红原因及解决方法

Object类与常用API

IO process thread -> thread -> day5

idea uses @Autowired annotation to explain the reasons and solutions

shell脚本循环语句
随机推荐
信息编码、存储压缩与密码学
OptionError: ‘Pattern matched multiple keys‘
Redis6学习笔记
第四次培训
高可用 两地三中心
VR全景展打造专属元宇宙观展空间
MySql数据库
Unity2D horizontal board game tutorial 6 - enemy AI and attack animation
2. 两数相加
idea使用@Autowired注解爆红原因及解决方法
Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
typescript49-交叉类型
typescript42-readonly修饰符
Lambda表达式案例
VSO Downloader Ultimate 5.0.1.45 中文多语免费版 在线视频下载工具
idea uses @Autowired annotation to explain the reasons and solutions
ModelArts第二次培训
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)
Get the Ip tool class
【特征选取】计算数据点曲率