Cod sursa(job #117223)

Utilizator DastasIonescu Vlad Dastas Data 20 decembrie 2007 22:48:36
Problema Plus Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 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 )
        {
            long long t = i*b + j*d;

            if ( e*f >= s - t )
                ++sol;
        }

    fprintf(out, "%lld\n", sol);

	return 0;
}

/*
           for ( int k = 0; k <= e; ++k )
                if ( i*b + j*d + k*f == s )
                    ++sol;
*/