#include<iostream>using namespace std;int main(void){	//freopen("in.txt", "r", stdin);	int M, N;	scanf("%d %d", &M, &N);	int num = M*N;//總個數	int cur, cnt = 1;//分別為當前顏色,個數	scanf("%d", &cur);//先讀入第一個,初始化。	for (int i = 1; i < num; i++)	{		int tem;		scanf("%d", &tem);		if (cur == tem)//相等,自增			cnt++;		else		{			cnt--;			if (cnt < 0)			{				cur = tem;//小于0,更換主元素,cnt設為1				cnt = 1;			}		}	}	printf("%d/n", cur);	return 0;}
新聞熱點
疑難解答