Pagini recente » Cod sursa (job #1030870) | Cod sursa (job #1595222) | Cod sursa (job #1045629) | Cod sursa (job #1707995) | Cod sursa (job #7759)
Cod sursa(job #7759)
#include<cstdio>
#define dim 1 << 12
int N, A[dim][dim];
long M;
long long unsigned SOL;
void read()
{
freopen("triplete.in", "r", stdin);
scanf("%d %ld", &N, &M);
long i, a, b;
for(i=1; i<=M; ++i)
{
scanf("%d %d", &a, &b);
A[a][b] = A[b][a] = 1;
}
}
void write()
{
freopen("triplete.out", "w", stdout);
printf("%llu", SOL);
}
int main()
{
read();
int i, j, k;
for(i=1; i<=N-2; ++i)
for(j=i+1; j<N; ++j)
for(k=j+1; k<=N; ++k)
if(A[i][j] && A[j][k] && A[k][i])
++ SOL;
write();
fclose(stdin); fclose(stdout);
return 0;
}