1.Coins - AtCoder abc087_b - Virtual Judge (vjudge.net)
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 long long a,b,c,x,ans; 5 int main() 6 { 7 8 cin>>a>>b>>c>>x; 9 for(int i=0;i<=a;i++)//枚举500硬币的个数 10 for(int j=0;j<=b;j++)//枚举100硬币的个数 11 for(int z=0;z<=c;z++){//枚举50硬币的个数 12 int k=i*500+j*100+z*50;//定义k为此时硬币总值 13 if(k==x) 14 ans++; 15 if(k>x) 16 break; 17 } 18 cout<<ans<<endl; 19 return 0; 20 }View Code
标签:ix,暴力,int,Coins,long,枚举 From: https://www.cnblogs.com/rw666/p/17809975.html