只要注意将工资从大到小依次分解就可以让钞票数最小
#include<iostream>
using namespace std;
int main()
{
int num(int n);
int n,i,a;
while(cin>>n&&n!=0)
{
int sum=0;
for(i=0;i<n;i++)
{
cin>>a;
sum=sum+num(a);
}
cout<<sum<<endl;
}
}
int num(int n)
{
int a,b,c,d,e,f,sum;
a=n/100;
n=n-a*100;
b=n/50;
n=n-b*50;
c=n/10;
n=n-c*10;
d=n/5;
n=n-5*d;
e=n/2;
f=n-2*e;
sum=a+b+c+d+e+f;
return sum;
}