文章标题
来源:互联网 发布:win10备份c盘数据 编辑:程序博客网 时间:2024/06/03 17:46
#include<iostream>#include<string>using namespace std;int main(){ string s; string::iterator itb, it; int len, ans = 0, i, j; int b = 0; cin >> len >> s; itb = s.begin(); it = s.end() - 1; if(len > 1) while (true) { if (it != itb && *itb != *it) --it; else if (it == itb) { if(len % 2 != 1 || b == 1) { b = 2; break; } char x = *it; s.erase(it); s.insert(itb + s.size() / 2, x); ans += s.size() / 2; b = 1; it = s.end() - 1; } else { ans += s.end() - it - 1; s.erase(it); s.erase(itb); if (s.size() < 2) break; it = s.end() - 1; } } if (b != 2) cout << ans; else cout << "Impossible"; return 0;}
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- JAVA类加载器
- Java io流一些工具练习 转换流,内存流
- Android 8.0 API变化
- Pascal's Triangle II
- Oracle精选面试题及答案
- 文章标题
- 在CentOS7/CentOS6中支持exfat格式的U盘
- 测试计划的目的和内容
- Mac版Android Studio工具快捷键总结
- java获取内网ip地址
- 关于Vue.js的一些总结(2)
- GO tcp server demo
- Android原生项目集成React Native
- 分析Linux内核创建一个新进程的过程