sdnu1035找零钱
来源:互联网 发布:linux awk 分隔符 编辑:程序博客网 时间:2024/05/16 06:16
1035.找零钱
Time Limit: 1000 MS Memory Limit: 32768 KB
Total Submission(s): 363 Accepted Submission(s): 174
Description
我手头有N元钱(10<=N<=100),我想将其换成1元、5元、10元一张的小钞票。问:一共有多少种换法?
Input
要换的N元,如100
Output
共有多少种换法
Sample Input
10
Sample Output
4
Hint
比如100元,有一种换法:
10元: 9 张
5元: 1 张
1元: 5 张
Source
SDNU ACM-ICPC 2012 Training
Submit
Statistic
Discuss
#include<stdio.h>int main(){ int n,a,b,c,s; while(scanf("%d",&n)!=EOF) { s=0; for(a=0;a<=n/10;a++) { for(b=0;b<=(n%10)/5;b++) { for(c=0;c<=n;c++) { if(a*10+b*5+c==n) s++; } } } printf("%d\n",s); } return 0;}
阅读全文
0 0
- sdnu1035找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱!
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 找零钱
- 动态归化 找零钱
- c++的新型数组
- Merge Two Binary Trees(leetcode)
- Java 可变参数
- 指针与地址
- 一组数排序
- sdnu1035找零钱
- CSP 2017-03
- 1.3创建一个主动套接字
- 51nod 1770 数数字 找规律,注意进位,时间复杂度O(n)
- 最小生成树———灌溉
- 关于一个简易的Html5音乐播放器的制作
- 15算法课程 107. Binary Tree Level Order Traversal II
- 汇编语言学习笔记(一)
- 素数环UVa524