题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2021
题目大意:给老师发工资,找出最少的人民币张数。
1 #include <stdio.h> 2 int main () 3 { 4 int a,n,i,sum; 5 while (scanf("%d",&n),n) 6 { 7 sum=0; 8 for (i=1; i<=n; i++) 9 { 10 scanf ("%d",&a); 11 sum+=a/100; 12 a=a%100; 13 sum+=a/50; 14 a=a%50; 15 sum+=a/10; 16 a=a%10; 17 sum+=a/5; 18 a=a%5; 19 sum+=a/2; 20 a=a%2; 21 sum+=a/1; 22 } 23 printf ("%d ",sum); 24 } 25 }