codeforces 268A problem solution in c/c++


#include <iostream>
#include<string>
using namespace std;
int main()
{
int anis[1000];
int n, i, j=1, a, b;
cin >> n;
for (i = 0;i < n;i++)
{
cin >> a >> b;
anis[j] = a;
j++;
anis[j] = b;
j++;
}
int z, v=0;
z = j;
for (i = 1;i < z;i+=2)
{
for (j = 2;j < z;j += 2)
{
if (anis[i] == anis[j])
{
v++;
}
}

}
cout << v << endl;
 
}


Comments

Popular posts from this blog

codeforces 472A problem solution in simple c/c++

codeforces 339A solution in c/c++

codeforces 520A problem solution in c/c++