<span style="font-size:18px;">#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int v[6]={1,5,10,50,100,500};
int c[6];
int A;
int main()
{
for(int i=0;i<6;i++)
{
scanf("%d,",&c[i]);
}
scanf("%d",&A);
int ans=0;
for(int i=5;i>=0;i--)
{
int t=min(A/v[i],c[i]);
A-=t*v[i];
ans+=t;
}
printf("%d\n",ans);
return 0;
}</span>
<span style="font-size:18px;">贪心算法</span>