Cod sursa(job #53466)

Utilizator alextheroTandrau Alexandru alexthero Data 22 aprilie 2007 11:17:28
Problema Oite Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <stdio.h>

#define cmax 1024

int a[cmax],i,j,c,L,k,l;

int main() {
	freopen("oite.in","r",stdin);
	freopen("oite.out","w",stdout);

	scanf("%d%d",&c,&L);
	for(i = 0; i < c; i++) scanf("%d",&a[i]);

	int tot = 0;
	
	for(i = 0; i < c; i ++)
		for(j = i + 1; j < c; j++) 
			for(k = j + 1; k < c; k++)
				for(l = k + 1; l < c; l++) 
					if(a[i] + a[j] + a[k] + a[l] == L) tot++;

	printf("%d\n",tot);
	return 0;
}