Thursday, July 3, 2014

Codeforces Round #164 (Div. 2), problem: (A) Games solution

Codeforces Round #164 (Div. 2), problem: (A) Games: http://codeforces.com/problemset/problem/268/A

Codeforces Round #164 (Div. 2), problem: (A) Games editorial: http://codeforces.com/blog/entry/6545?locale=en

Codeforces Round #164 (Div. 2), problem: (A) Games solution: http://ideone.com/3fx0Ww


#include <iostream>
#include <cstdio>
using namespace std;

int main() {
 int n, a[35], h[35], cnt=0;
 scanf("%d", &n);
 for(int i=0; i<n; i++) scanf("%d%d", &a[i], &h[i]);
 for(int i=0; i<n; i++) for(int j=0; j<n; j++) if(h[i]==a[j] && i!=j) cnt++;
 printf("%d", cnt);
 return 0;
}


No comments:

Post a Comment