Cod sursa(job #483482)

Utilizator andrei.dAndrei Diaconeasa andrei.d Data 8 septembrie 2010 22:02:18
Problema Plus Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include <cstdio>

#define file_in "plus.in"
#define file_out "plus.out"

int S;
int NrB1,Nr1;
int NrB2,Nr2;
int NrB3,Nr3;

void adfile(void){
	
	freopen(file_in,"r",stdin);
	freopen(file_out,"w",stdout);
	
	scanf("%d", &S);
	scanf("%d %d", &NrB1, &Nr1);
	scanf("%d %d", &NrB2, &Nr2);
	scanf("%d %d", &NrB3, &Nr3);
}

void solve(void){
	
	//romanu` n-are noroc
	//da` se pricepe la tot
	int ans=0;
	int i,j,k;
	for (i=0;i<=NrB1;++i)
         for (j=0;j<=NrB2;++j) 
               for (k=0;k<=NrB3;++k)
                     if (i*Nr1+j*Nr2+k*Nr3==S)
                         ans++;
	
	printf("%d\n", ans);
}	
  	
	
int main(){

	adfile();
	solve();
	
	return 0;
	
}