首页 > 其他 > 详细

Codeforces Round #243 (Div. 2) B. Sereja and Mirroring

时间:2014-04-29 17:40:49      阅读:442      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int> > a(n,vector<int>(m,0));
    for(int i = 0; i < n; ++ i){
        for(int j = 0 ; j < m ; ++ j){
            cin >> a[i][j];
        }
    }
    if(n%2) cout<<n<<endl;
    else{
        int left= 0 ,right =n-1, preRight = n-1;
        while(left < right){
            if(a[left] != a[right]) break;
            else left++,right--;
            if(left-1 == right) left = 0,preRight = right;
        }
        cout<<preRight+1<<endl;
    }
}
bubuko.com,布布扣

 

Codeforces Round #243 (Div. 2) B. Sereja and Mirroring,布布扣,bubuko.com

Codeforces Round #243 (Div. 2) B. Sereja and Mirroring

原文:http://www.cnblogs.com/xiongqiangcs/p/3698165.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!