You are viewing a single comment's thread. Return to all comments →
SHORTEST CODE TO THIS QUESTION
int min(int a, int b) {int c=a; if(a>b) c=b; return c; }
int main() { int t,n,a,b,c,d,i,j,k,l; scanf("%d",&t);
while(t--) {int x=0; scanf("%d %d %d %d %d",&n,&a,&b,&c,&d); for(i=min(d,n/10);i>=0;i--) { for(j=min((n-10*i)/5,c);j>=0;j--) { for(k=min(b,(n-10*i-5*j)/2);k>=0;k--) { for(l=min(a,(n-10*i-5*j-2*k));l>=0;l--) { if(10*i+5*j+2*k+l==n) { x++; break; } } } } } printf("%d\n",x); } 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 →
SHORTEST CODE TO THIS QUESTION
int min(int a, int b) {int c=a; if(a>b) c=b; return c; }
int main() { int t,n,a,b,c,d,i,j,k,l; scanf("%d",&t);
}