2020暑期培训day5

t1匹配

#include <bits/stdc++.h>
using namespace std;
int ans, sum, n;
string s1, s2;
int main(){
    freopen("rotate.in", "r", stdin);
    freopen("rotate.out", "w", stdout);
    cin >> n;
    cin >> s1 >> s2;
    for (int i = 0; i < n; i++){
        sum = 0;
        for (int j = 0; j < n; j++)
            if (s1[(i+j)%n] == s2[j]) sum++;
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

 

上一篇:day5 代码块,流程控制


下一篇:宏任务和微任务