Pagini recente » Cod sursa (job #2011310) | Cod sursa (job #951296) | Cod sursa (job #2720337) | Cod sursa (job #1276805) | Cod sursa (job #449064)
Cod sursa(job #449064)
#include<fstream>
#include<bitset>
#include<vector>
using namespace std;
typedef unsigned long long int64;
void read();
void write();
void doit();
int64 n, m;
vector<bitset<4097> > v(4097);
int64 tr;
int main()
{
read();
doit();
write();
return 0;
}
void read()
{
ifstream fin( "triplete.in" );
fin >> n >> m;
int64 a, b;
for ( int64 i = 0; i < m; ++i )
{
fin >> a >> b;
if ( a < b )
v[a][b] = 1;
else
v[b][a] = 1;
}
fin.close();
}
void write()
{
ofstream fout( "triplete.out" );
fout << tr;
fout.close();
}
void doit()
{
for ( int64 i = 0; i < n; ++i )
{
int64 nrb = v[i].count();
tr += nrb * ( nrb - 1 ) / 2;
}
}