Codeforces Round #187 (Div. 2) A. Sereja and Bottles

题目链接:http://codeforces.com/contest/315/problem/A

这到题目比赛的时候过了,赛后WA了……虽然很简单,但是还是没想太清楚

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstdlib>
 4 using namespace std;
 5 #define MAX 103
 6 int a[MAX], b[MAX];
 7 int main(void) {
 8     int n;
 9 #ifndef ONLINE_JUDGE
10     freopen("187a.in", "r", stdin);
11 #endif
12     while (~scanf("%d", &n)) {
13         for (int i = 0; i < n; ++i) scanf("%d%d", a+i, b+i);
14         int cnt = 0;
15         for (int i = 0; i < n; ++i) {
16             bool flag = false;
17             for (int j = 0; j < n; ++j) {
18                 if (i!=j && a[i] == b[j]) {
19                     flag = true; break;
20                 }
21             }
22             if (!flag) cnt++;
23         }
24         printf("%d\n", cnt);
25 
26     }
27 
28     return 0;
29 }

所以,这些简单题考的是反应速度

原文地址:https://www.cnblogs.com/liuxueyang/p/3127321.html