Pagini recente » Cod sursa (job #1994261) | Cod sursa (job #127552) | Cod sursa (job #1145960) | Cod sursa (job #1787031) | Cod sursa (job #996499)
Cod sursa(job #996499)
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
//map<long,long> H;
#define P1 7
#define P2 29
#define P3 281
//long S[P1][P2][P3];
long H[P1][P2][P3];
int main() {
ifstream I("oite.in");
ofstream O("oite.out");
long c,C,L, A[1024];
I >> C >> L;
c = 0;
int i,j,k,l;
while(c < C) {
long val;
I >> val;
if(val <= L-3) {
A[c] = val;
c++;
};
};
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++) {
long s = A[i]+A[j]+A[k]+A[l];
H[s % P1][s % P2][s % P3]++;
};
};
};
};
O << H[L%P1][L%P2][L%P3];
};