标签:
#include <cstdio>
#include <iostream>
using namespace std;
const int V[6]={1,5,10,50,100,500};
int C[6];
int A;
void solve()
{
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);
}
int main()
{
printf("C[6]:\n");
for(int i=0;i<6;i++)
{
scanf("%d",&C[i]);
}
printf("A:\n");
scanf("%d",&A);
solve();
return 0;
}
标签:
原文地址:http://blog.csdn.net/nomasp/article/details/45844357