A simple Blog for wyx I've been down the bottle hoping.
3725: PA2014 Final Matryca
发表于: | 分类: Oi | 评论:0 | 阅读:61

答案显然是$len+1- \min {j-i+1}, col_i \neq col_j $且两个东西都不是*

显然答案如果比他还小当然会出现重叠混色的问题……

普及组难度

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
const int N = 1e6+5;
using namespace std;
char str[N];
int main()
{
    scanf("%s",str);
    int n = strlen(str);
    int Min = n, now=0;
    int last = 0;
    register int i = 0;
    for(;str[i];++i) {
        if(str[i] != '*')  {
            if(!last) {
                last = str[i];
                now = i;
            }
            else if(last != str[i]) {
                Min = min(Min,i-now);
                now = i; last = str[i];
            }
            else now = i;
        }
    }
    cout << n - Min + 1 << endl;
}

Title - Artist
0:00

站点地图 网站地图
Copyright © 2015-2017 A simple Blog for wyx
Powered by Typecho自豪的采用Sgreen主题

TOP