题目连接:http://codeforces.com/contest/798/problem/C C. Mike and gcd problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has a sequence A = [a1, a2, ..., an] of length n. He considers…
如果一开始就满足题意,不用变换. 否则,如果对一对ai,ai+1用此变换,设新的gcd为d,则有(ai - ai+1)mod d = 0,(ai + ai+1)mod d = 0 变化一下就是2 ai mod d = 0 2 ai+1 mod d = 0 也就是说,用两次变换之后,gcd至少扩大2倍,于是,最优方案就是我们将所有的奇数都变成偶数. 只需要找出所有奇数段,答案就是sigma([奇数段的长度/2]+(奇数段的长度 mod 2 ==1 ?)). #include<cstdio> #i…
E. Mike and Geometry Problem 题目连接: http://www.codeforces.com/contest/689/problem/E Description Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to…
任意门:http://codeforces.com/contest/689/problem/E E. Mike and Geometry Problem time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Mike wants to prepare for IMO but he doesn't know geometry, so…
E. Mike and Geometry Problem time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry pro…
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…
B. Mike and strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si,…
传送门 Description Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si, erase the first character and append it to the end of the string. For example, if he has the string "coolmike"…
题目链接:传送门 题目大意:给你n个区间,求任意k个区间交所包含点的数目之和. 题目思路:将n个区间都离散化掉,然后对于一个覆盖的区间,如果覆盖数cnt>=k,则数目应该加上 区间长度*(cnt与k的组合数) ans=ans+(len*C(cnt,k))%mod; #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <algorith…