Cod sursa(job #117207)
Utilizator | Ionescu Vlad Dastas | Data | 20 decembrie 2007 22:35:29 |
---|---|---|---|
Problema | Plus | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <cstdio>
FILE *in = fopen("plus.in","r"), *out = fopen("plus.out","w");
int s;
int a, b,
c, d,
e, f;
long long sol;
int main()
{
fscanf(in, "%d\n%d %d\n%d %d\n%d %d\n", &s, &a,&b,&c,&d,&e,&f);
for ( int i = 0; i <= a; ++i )
for ( int j = 0; j <= c; ++j )
for ( int k = 0; k <= e; ++k )
if ( i*b + j*d + k*f == s )
++sol;
fprintf(out, "%lld\n", sol);
return 0;
}