2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1)

思路:

Exam

思路:水题

代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
    int k;
    scanf("%d",&k);
    char s1[1010],s2[1010];
    scanf("%s%s",s1,s2);
    int same=0;
    int n=strlen(s1);
    for(int i=0;i<n;i++){
        same+=s1[i]==s2[i];
    }
    cout<<min(same,k)+min(n-same,n-k)<<endl;
    return 0;
}
View Code

相关文章:

  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
猜你喜欢
  • 2021-12-12
  • 2021-08-22
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案