数钱
题目描述
按照中国的币制有 1元,5元,10元,20元,50元,100元
给出钱数n(n能用int存储),输入最少多少张钱能补足n。
输入
k
n
输出
钱的张数
样例输入
4
123
200
1875
20
样例输出
5
2
21
1
#include<stdio.h>
int main()
{int k;scanf("%d",&k);while(k--){int n;scanf("%d",&n);int count=0;count=n/100;count+=n%100/50;count+=n%100%50/20;count+=n%100%50%20/10;count+=n%100%50%20%10/5;count+=n%100%50%20%10%5/1;printf("%d\n",count);}return 0;
}