首页 > 其他 > 详细

字符串模拟赛T3

时间:2016-07-20 21:08:39      阅读:79      评论:0      收藏:0      [点我收藏+]

技术分享

只看我的做法就够了

#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
const int maxn = 1005;
int n,m,ans;
char a[maxn],b[maxn];
int main(){
    cin>>a>>b;
    n = strlen(a);
    m = strlen(b);
    int l,r,tmp;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            tmp = 0;
            for(int k = 1;i + k -1 < n && j + k -1 < m;k++){
                if(a[i+k-1] == 1 && b[j+k-1] == 1) tmp++;
            }
            if(ans < tmp) ans = tmp;
        }
    }
    cout<<ans;
    return 0;
}

 

字符串模拟赛T3

原文:http://www.cnblogs.com/hyfer/p/5689481.html

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