Divisibility 我们考虑删数字 首先我们可以发现有一类数很特殊就是大于 n / 2的素数, 因为这些素数的贡献只有1, 并且在n大的时候, 这些素数的个数不是很少, 我们可以最后用这些数去调整, 并且删掉一个数的时候删掉的是它的因子个数, 所以可以用素数去控制最后的数量.当n小的时候直接状压枚举. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk mak…
题目链接  Divisibility 题意 给定$n$和$k$,构造一个集合$\left\{1, 2, 3, ..., n \right\}$的子集,使得在这个集合中恰好有$k$对正整数$(x, y)$, $x < y$ 满足$x$是$y$的约数. 选定$1$和$2$, 首先把满足 $x > [\frac{n}{2}]\ $的质数$x$留出来, 然后把满足 $ [\frac{n}{3}]\  < x <=  [\frac{n}{2}]\ $的质数,以及他们的两倍留出来,   留出来…
正解:构造+数论 解题报告: 传送门! maya这题好神仙啊我jio得,,,反正我当初听的时候是没有太懂的,,, 首先这题你要知道一些必要的数学姿势 比如哥德巴赫猜想巴拉巴拉的 然后直接讲题趴QAQ 首先看到说,分成质数之后,不难想到哥德巴赫猜想(,,,什么鬼辣我连哥德巴赫猜想的内容都不清楚哪里不难想到了QAQ (哥德巴赫猜想:任一大于2的偶数可分为不同俩质数之和) 然后对这n个数的和:sum=n*(n+1)/2分类讨论 1)sum为质数 欧克分成一组就成了! 2)sum为非2偶数 利用哥德巴赫…
Codeforces 1041 E 构造题. 给出一种操作,对于一棵树,去掉它的一条边.那么这颗树被分成两个部分,两个部分的分别的最大值就是这次操作的答案. 现在给出一棵树所有操作的结果,问能不能构造这样一颗树,可以的话输出它. 反正就是看每个数出现了几次,然后形成一条链,从这个数开始,依次减小,链向N. 这样处理每个数,就行了. 中间一旦有冲突(不能形成链了),直接NO. #include <bits/stdc++.h> using namespace std; map<int,int…
[CodeForces - 1225C]p-binary [数论][二进制] 标签: 题解 codeforces题解 数论 题目描述 Time limit 2000 ms Memory limit 524288 kB Source Technocup 2020 - Elimination Round 2 Tags bitmasks brute force math *1600 Site https://codeforces.com/problemset/problem/1225/c 题面 Exa…
题目链接: C. Prefix Product Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider a sequence [a1, a2, ... , an]. Define its prefix product sequence . Now given n, find a permutation…
 Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain…
https://codeforces.com/problemset/problem/474/D 这道题挺好的,思路是这样. 我们要找一个01串,其中0的段要被划分为若干个连续k的0. 我们设想一个长度为n的合法串是怎么被构造出来的,要么是上一个合法串后面直接连接1,要么是上一个合法串后面连接k个连续的0,那么每个0一一对应于一段连续的0. 所以dp[i]=dp[i-1]+dp[i-k]. 想出来就觉得不难了. #include<bits/stdc++.h> using namespace st…
题目:http://codeforces.com/problemset/problem/597/A Divisibility time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Find the number of k-divisible numbers on the segment [a, b]. In other words y…
题目链接:https://codeforces.com/contest/1368/problem/B 题意 构造最短的至少含有 $k$ 个 $codeforces$ 子序列的字符串. 题解 如下表:   c o d e f o r c e s 子序列个数 个数 1 1 1 1 1 1 1 1 1 1 $1^{10}$   2 2 2 2 2 2 2 2 2 2 $2^{10}$   3 3 3 3 3 3 3 3 3 3 $3^{10}$ 依次构造每个字符的个数即可. 证明   c o d e…