Div2 A求调
  • 板块学术版
  • 楼主huangyin_qwq
  • 当前回复7
  • 已保存回复7
  • 发布时间2022/9/10 18:36
  • 上次更新2023/10/27 12:06:10
查看原帖
Div2 A求调
686211
huangyin_qwq楼主2022/9/10 18:36
#include <bits/stdc++.h>
using namespace std;
int a,d,e;
int b[500000],c[500000];
int main(){
    e = 1;
    cin >> a;
    for(int i = 1;i <= a;i++){
        cin >> b[i];
    }
    for(int j = 1;j <= a;j++){
        cin >> c[j];
    }
    for(int t = 1;t <= a;t++){
        if(b[t] != c[t]){
            d += 1;
        }
    }
    for(int v = 1;v <= a;v++){
        if(b[a - v + 1] != c[v]){
            e += 1;
        }
    }
    if(d <= e){
        cout << d << endl;
    }else{
        cout << e << endl;
    }
    return 0;
}

40pts

2022/9/10 18:36
加载中...