当前位置:网站首页>-钞票兑换-
-钞票兑换-
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);
}
边栏推荐
- Alienware上线首个数字时装AR试穿体验
- Djiango第四次培训笔记
- Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
- 业务表解析-余额系统
- Pr第四次培训笔记
- Lambda表达式案例
- IO流及其操作
- Detailed explanation of MOSN reverse channel
- typescript40-class类的保护修饰符
- Modified BiotinDIAZO-Biotin-PEG3-DBCO|diazo-biotin-tripolyethylene glycol-diphenylcyclooctyne
猜你喜欢
随机推荐
【特征选取】计算数据点曲率
1. 两数之和
MySql数据库
2022暑假牛客多校联赛第一场
在树莓派上搭建属于自己的网页(1)
Response 重写设置返回值
Flask Web 报错:
typescript43-类型兼容性说明
Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
dataframe插入一列
Alienware上线首个数字时装AR试穿体验
ss-4.2 多个eureka集群案例
C# async and multithreading
阿里云对象存储oss私有桶生成链接
高可用 两地三中心
celery工作原理图
Unity2D horizontal board game tutorial 6 - enemy AI and attack animation
Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
Interface Test Framework Practice (4) | Get Schema Assertion
minio下载文件乱码或者是一条横线