链接: https://codeforces.com/gym/102394/problem/J 题意: The great mathematician DreamGrid proposes a conjecture, which states that: Every positive integer can be expressed as the sum of a prime number and a composite number. DreamGrid can't justify his c…
题解: https://files.cnblogs.com/files/clrs97/HarbinEditorialV2.zip Code: A. Artful Paintings /* let x=f[n] f[i-1]-f[i]<=0 i -> i-1 0 f[i]-f[i-1]<=1 i-1 -> i 1 f[l-1]-f[r]<=-k r -> l-1 -k f[r]-f[l-1]<=-k+x l-1 -> r -k+x f[n]-f[0]<=…
链接: https://codeforces.com/gym/102394/problem/F 题意: Harbin, whose name was originally a Manchu word meaning "a place for drying fishing nets", grew from a small rural settlement on the Songhua River to become one of the largest cities in Northea…
链接: https://codeforces.com/gym/102394/problem/K 题意: DreamGrid is the keeper of n rabbits. Initially, the i-th (1≤i≤n) rabbit has a weight of wi. Every morning, DreamGrid gives the rabbits a carrot of weight 1 and the rabbits fight for the only carrot…
链接: https://codeforces.com/gym/102394/problem/I 题意: DreamGrid has an interesting permutation of 1,2,-,n denoted by a1,a2,-,an. He generates three sequences f, g and h, all of length n, according to the permutation a in the way described below: For ea…
比赛链接:传送门 上半场5题,下半场疯狂挂机,然后又是差一题金,万年银首也太难受了. (每次银首都会想起前队友的灵魂拷问:你们队练习的时候进金区的次数多不多啊?) Problem J. Justifying the Conjecture 00:09 (+) Solved by Dancepted 签到.好像见过很多次了,经典水题.然后英语太差了,理解题意用了不少时间. 代码: #include <bits/stdc++.h> #define endl '\n' using namespace…
A: Super_palindrome 题面:给出一个字符串,求改变最少的字符个数使得这个串所有长度为奇数的子串都是回文串 思路:显然,这个字符串肯定要改成所有奇数位相同并且所有偶数位相同 那统计一下奇数位上哪个字符出现的个数最多,偶数位上哪个字符出现的个数最多 答案就是 n 减去它们 #include <bits/stdc++.h> using namespace std; #define N 110 #define INF 0x3f3f3f3f int t; char s[N]; ]; ]…
传送门 D - Decimal 题意: 询问\(\frac{1}{n}\)是否为有限小数. 思路: 拆质因子,看是不是只包含2和5即可,否则除不尽. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #define se second #define sz(x) (int)(x).size() using namespace std; typedef long long ll; typedef pair<…
题目链接:https://codeforces.com/gym/102361/problem/F 题意 有 \(n\) 个点和 \(m\) 条边,每条边属于 \(0\) 或 \(1\) 个环,问去掉一些边使得图变为森林的方案个数. 题解 找出所有环的长度 \(c_i\),每个环可以去掉 \(1,2,\dots,c_i\) 条边,方案各为 \(C_{c_i}^1,C_{c_i}^2, \dots C_{c_i}^{c_i}\),即 \(2^{c_i} - 1\) . 所有环的去边方案共有 \(\p…
Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 429    Accepted Submission(s): 244 Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a…