Pagini recente » Cod sursa (job #2751962) | Cod sursa (job #150967) | Cod sursa (job #2829794) | Cod sursa (job #2097297) | Cod sursa (job #763592)
Cod sursa(job #763592)
#include<fstream>
using namespace std;
#define NN 4096
ofstream out("triplete.out");
bool a[NN][NN];
int n,m;
long long ans;
void read();
void solve();
bool inside(int ,int);
int main()
{
read();
solve();
out<<ans/6;
return 0;
}
void read()
{
ifstream in("triplete.in");
in>>n>>m;
for(int x,y;m;--m)
{
in>>x>>y;
a[x][y]=a[y][x]=1;
}
}
bool inside(int x,int y)
{
if(a[x][y]==1&&a[y][x]==1)
return 1;
return 0;
}
void solve()
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
for(int k=1;k<=n;k++)
{
if(a[i][j] && a[i][k] && a[j][k])
++ans;
}
}
}
}