Codeforces 798A - Mike and palindrome】的更多相关文章

A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the s…
A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the s…
A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has a string s consisting of only lowercase English letters. He wants to change exactly onecharacter from the st…
/* CF410div2 A. Mike and palindrome http://codeforces.com/contest/798/problem/A 水题 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <queue> #include <iostream&g…
hdu4135 求[L,R]范围内与N互质的数的个数. 分别求[1,L]和[1,R]和n互质的个数,求差. 利用容斥原理求解. 二进制枚举每一种质数的组合,奇加偶减. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int fac[N], cnt; void factor(int n) { cnt = ; int limit = sqrt(n); ; i <= limit; ++i) { ) fa…
codeforces 547E Mike and Friends 题意 题解 代码 #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i=(a); i<(b); i++) #define per(i, a, b) for(int i=(b)…
codeforces 689 Mike and Shortcuts(最短路) 原题 任意两点的距离是序号差,那么相邻点之间建边即可,同时加上题目提供的边 跑一遍dijkstra可得1点到每个点的最短路,时间复杂度是O(mlogm) #include <cstdio> #include <iostream> #include <cstring> #include <queue> #include <vector> using namespace s…
[题目链接]:http://codeforces.com/contest/798/problem/A [题意] 让你严格改变一个字符,使得改变后的字符串为一个回文串; 让你输出可不可能; [题解] 直接无脑暴力改就好; 或者按照回文串的规则; 如果a[i]和a[n-i+1]不同则cnt++ 然后看看最后cnt是不是恰好为1,或者为0然后字符串长度为奇数(那样中间那个字符可以任意改) [Number Of WA] 0 [完整代码] #include <bits/stdc++.h> using n…
题目链接 一个简单的题目,但是却很少有人可以一次AC,比如我就瞎写wa了一次... 写本博算个教训录吧. 题目给出一个字符串,让你严格的改变一个字符使改变后的字符串是一个回文串. 回文串不用解释了.不懂自行百度. 需要注意两点: 1.如果长度为偶数,并且事先就是一个回文串,那么要输出no的,因为必须要改变一个字符串,在原本就是回文的基础上改变一下就不是回文串了. 2.如果长度为奇数,并且事先就是一个回文串,那么要输出yes,因为可以只改变最中间的那个字符,改后还是一个回文串. 其他的就是判断有几…
传送门 B. Mike and Fun time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m g…