You are viewing a single comment's thread. Return to all comments →
Solution for C++
#include<bits/stdc++.h> typedef long long ll; using namespace std; const int modd=1e9; int T,n,a,b,c,d; ll ans; int main() { ios::sync_with_stdio(false); cin>>T; while(T--) { cin>>n,ans=0; cin>>a>>b>>c>>d; for(int i=0; i<=min(d,n/10); i++) for(int j=0; j<=min(c,n/5); j++) for(int k=0; k<=min(b,n/2); k++) if(n-10*i-5*j-2*k<=a&&n-10*i-5*j-2*k>=0) ans++; cout<<ans<<endl; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Coinage
You are viewing a single comment's thread. Return to all comments →
Solution for C++