Pagini recente » Cod sursa (job #1138719) | Cod sursa (job #2724279) | Cod sursa (job #262518) | Cod sursa (job #2035865) | Cod sursa (job #2561525)
#include <fstream>
using namespace std;
ifstream f ( "triplete.in" );
ofstream g ( "triplete.out" );
bool a[4100][4100];
struct relatii
{
int x, y;
};
relatii v[4100 * 16];
bool cmpx ( relatii a, relatii b )
{
if ( a.x == b.x )
return a.y < b.y;
return a.x < b.x;
}
int main()
{
int x1, y1, N, M, nrt = 0;
f >> N >> M;
for ( int i = 1; i <= M; i++ )
{
f >> x1 >> y1;
a[x1][y1] = a[y1][x1] = 1;
v[i].x = x1;
v[i].y = y1;
for ( int j = 1; j <= N; j++ )
if ( a[j][x1] == 1 && a[j][y1] == 1 )
nrt++;
}
g << nrt;
return 0;
}