【链接】 我是链接,点我呀:)

【题意】

题意

【题解】

注意只能改变a不能改变b
然后只要让a[i],b[i],a[n-i-1],b[n-i-1]这4个字符能凑成两对、全都一样就可以了
分类讨论下就好

【代码】

#include <bits/stdc++.h>
#define ll long long
using namespace std; const int N = 300; int n;
string s1,s2;
map<char,int> dic,dic1; int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
cin >> s1;
cin >> s2;
int cnt = 0;
for (int i = 0;i < n/2;i++){
dic.clear();dic1.clear();
dic[s1[i]]++;
dic[s1[n-i-1]]++; dic1[s2[i]]++;
dic1[s2[n-i-1]]++;
int k1 = dic.size(),k2 = dic1.size();
if (k1==1 && k2==1){
cnt+=0;
}
if (k1==1 && k2==2){
dic1[s1[i]] = 1;
int t = dic1.size();
if (t==k2){
cnt++;
}else cnt+=2;
}
if (k1==2 && k2==1){
dic[s2[i]] = 1;
cnt++;
}
if (k1==2 && k2==2){
dic[s2[i]] = 1;
dic[s2[n-i-1]] = 1;
int t = dic.size();
if (t>k1+1){
cnt+=2;
}else if (t>k1){
cnt++;
}else cnt+=0;
}
}
if (n%2==1){
if (s1[n/2]!=s2[n/2]){
cnt++;
}
}
cout<<cnt<<endl;
return 0;
}

最新文章

  1. Modified Least Square Method and Ransan Method to Fit Circle from Data
  2. C# 得到sqlserver 数据库存储过程,触发器,视图,函数 的定义
  3. golang使用interface来mock进行测试(来自dotGO2014)
  4. 使用xml来显示获取的mysql数据
  5. ios7 自定义UINavigationBar UIBarButtonItem 10px的偏移纠正
  6. 值类型与引用类型(特殊的string) Typeof和GetType() 静态和非静态使用 参数传递 相关知识
  7. C#构造函数的 &quot;继承&quot; 问题
  8. VS下 dllimport与dllexport作用与区别
  9. InfluxDB安装和简介
  10. CSS之padding&amp;margin
  11. Add-Migration : 无法将“Add-Migration”项识别为 cmdlet、函数、脚本文件或可运行程序的名称
  12. NodeJs相关系列文章
  13. SpringBoot------个性化启动Banner设置
  14. zookeeper 单机版配置
  15. iOS-获取当前View所在的控制器
  16. Confluence 6 选项 1 – 在 Confluence 中手动重建用户和用户组
  17. 《DSP using MATLAB》Problem 4.15
  18. include方便查找
  19. CLR查找和加载程序集 z
  20. [Node.js]32. Level 7: Working with Lists -- Redis

热门文章

  1. [LOJ6041雅礼集训2017]事情的相似度
  2. AtCoder Regular Contest 074 F - Lotus Leaves
  3. Codeforces Round #261 (Div. 2) D
  4. nth Permutation LightOJ - 1060
  5. Squid启动报:Could not determine this machines public hostname. Please configure one or set &#39;visible_hostname&#39;.
  6. [转]Intellij Idea自动添加注释的方法
  7. 洛谷2017 5月月赛R1
  8. sybase sql anywhere 5.0 安装后sybase central中无法打开视图等的解决办法
  9. Mysql数据库表的迁移和表的复制
  10. Android(java)学习笔记174:服务(service)之混合方式开启服务