PAT_1054

题目地址:http://pat.zju.edu.cn/contests/pat-a-practise/1054

 1 #include<stdio.h>
 2 
 3 int main()
 4 {
 5     int r, v;
 6     int temp;
 7     int i, j;
 8     int color;
 9     int count = 0;
10     scanf("%d%d", &r, &v);    
11     for( i = 0; i < r; ++i )
12     {
13         for( j = 0; j < v; ++j )
14         {
15             scanf("%d", &temp);
16             if( 0 == count )
17             {
18                 color = temp;
19                 ++count;
20             }
21             else
22             {
23                 if( color == temp )
24                 {
25                     ++count;
26                 }
27                 else
28                 {
29                     --count;
30                 }
31             }
32         }
33     }
34     printf("%d\n", color);
35     return 0;
36 }
原文地址:https://www.cnblogs.com/shuanghong/p/3006370.html