CodeForces 798A Mike and palindrome
来源:互联网 发布:java zxing 二维码 编辑:程序博客网 时间:2024/05/16 12:25
题目链接:http://codeforces.com/contest/798/problem/A
题意:给你一个字符串,问你是否能只更改其中一个字母使得这个字符串是回文串
解析:原本是回文串,长度是偶数,那么是输出NO的,直接乱搞一下,就可以了
#include <bits/stdc++.h>using namespace std;int main(void){ string s1,s2; cin>>s1; s2 = s1; reverse(s1.begin(),s1.end()); int ans = 0; for(unsigned i=0;i<s1.length();i++) { if(s1[i]!=s2[i]) ans++; } if(ans==2 || (ans==0 && s1.length()%2)) puts("YES"); else puts("NO"); return 0;}
0 0
- codeforces 798a Mike and palindrome 水题
- CodeForces 798A Mike and palindrome
- Codeforces 798A -Mike and palindrome
- 小白题解 Codeforces 798A Mike and palindrome
- A. Mike and palindrome
- A. Mike and palindrome
- CF- 798A. Mike and palindrome
- 0514 CF#798A Mike and palindrome
- Codeforces Round #410 (Div. 2)-A. Mike and palindrome-思维
- Codeforces Round #410 (Div.2) A.Mike and palindrome-模拟
- CF#798 A. Mike and palindrome(水题)
- 【CodeForces】A. Mike and Frog
- Codefroces 410 A. Mike and palindrome
- Mike and Frog - CodeForces #547 A
- Codeforces 548 A. Mike and Fax
- CodeForces 548A Mike and Fax (回文)
- CodeForces 547A Mike and Frog
- CodeForces 689A Mike and Cellphone
- AI不可怕,就怕AI会画画——这里有一种你还不知道的‘图’灵测试…
- LeetCode117 Populating Next Right Pointers in Each Node II
- 技术男留存的好网站,再此收藏!
- 源码阅读--OkHttp3
- 火焰图相关的一些东西
- CodeForces 798A Mike and palindrome
- #HDU3435#A new Graph Game(环+KM)
- Ubuntu输入su提示认证失败的解决方法
- 编译原理(1)
- 数据库的水平分割和垂直分割
- leetcode:Jump Game II
- PHP设计模式系列(二十一):享元模式
- kafka-01-基础知识
- 基于 Django1.10 文档的深入学习(27)—— django.conf.urls utility functions 之 url(),include(),static()