PAT [A] 1054

来源:互联网 发布:时时彩程序源码 编辑:程序博客网 时间:2024/05/22 04:33

http://pat.zju.edu.cn/contests/pat-a-practise/1054

#include <stdio.h>int main (){    int m,n;    scanf("%d%d",&m,&n);    int newcolor;    int i,j;    int count=0;    int color=-1;    for(i=0;i<m;i++)     for(j=0;j<n;j++)     {     scanf("%d",&newcolor);     if(newcolor==color)     count++;     else{     if(count!=0)     count--;     else     color=newcolor;     }     }     printf("%d",color);     return 0;     }


0 0
原创粉丝点击