Pagini recente » Cod sursa (job #666271) | Cod sursa (job #3267082) | Cod sursa (job #2119462) | Cod sursa (job #251515) | Cod sursa (job #2449164)
#include <fstream>
#include <bitset>
using namespace std;
ifstream in("triplete.in");
ofstream out("triplete.out");
int n, m, rez;
bitset <4100> b[4100], aux;
int main()
{
int x, y;
in >> n >> m;
for (int i = 1; i <= m; ++i)
{
in >> x >> y;
b[x][y] = b[y][x] = 1;
}
for (int i = 2; i <= n; ++i)
{
for (int j = 1; j < i; ++j)
{
if (b[i][j] == 1)
{
aux = (b[i] & b[j]);
rez += aux.count();
}
}
}
out << rez / 3;
return 0;
}