Pagini recente » Cod sursa (job #238936) | Istoria paginii utilizator/mihnea_ciobotaru | Cod sursa (job #2689848) | Cod sursa (job #2169014) | Cod sursa (job #1762775)
#include <bits/stdc++.h>
using namespace std;
bitset<4104>a[4104];
bitset<4104>b;
int n, m;
void Read()
{
ifstream fin("triplete.in");
fin >> n >> m;
int i, x, y;
for(i = 1; i<=m; i++)
{
fin >> x >> y;
a[x][y] = 1;
a[y][x] = 1;
}
fin.close();
}
void Solve()
{
int i, j;
int sol = 0;
for(i = 1; i<=n-2; i++)
for(j = i+1; j<=n-1; j++)
{
b = (a[i]&a[j]);
b = ((b >> (j+0))<<(j+0));
sol += b.count();
}
ofstream fout("triplete.out");
fout << sol << "\n";
fout.close();
}
int main()
{
Read();
Solve();
return 0;
}