题目很水,不多说.........
#includeint main(){ long t,n,m,a,i,j,dp[10005],vol[505],jizhi[505],sum,w; scanf("%ld",&t); while(t--) { w=0; scanf("%ld%ld",&n,&m); sum=m-n; scanf("%ld",&a); for(i=0;i dp[j-vol[i]]+jizhi[i]) dp[j]=dp[j-vol[i]]+jizhi[i]; if(dp[sum]<10000000) printf("The minimum amount of money in the piggy-bank is %ld.\n",dp[sum]); else printf("This is impossible.\n"); } } return 0;}