首页 > 其他 > 详细

codeforces round #234B(DIV2) B Inna and New Matrix of Candies

时间:2014-03-08 21:48:40      阅读:517      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>

using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    set<int> distance;
    bool flag = true;
    for(int  i = 0 ; i < n; ++ i){
        string rectangle;
        cin >>  rectangle;
        int dwarf_pos = rectangle.find(G);
        int candy_pos = rectangle.find(S);
        int dist = candy_pos - dwarf_pos;
        if(dist > 0) distance.insert(dist);
        else flag = false;
    }
    if(!flag) cout<<-1<<endl;
    else cout<<distance.size()<<endl;
    return 0;
}
bubuko.com,布布扣

codeforces round #234B(DIV2) B Inna and New Matrix of Candies,布布扣,bubuko.com

codeforces round #234B(DIV2) B Inna and New Matrix of Candies

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

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