原文链接https://www.cnblogs.com/zhouzhendong/p/CF1016G.html 题目传送门 - CF1016G 题意 给定 $n,x,y$ ,以及一个含有 $n$ 个元素的数组 $a$ . 我们称一个数对 $(i,j)$ 是合法的,当且仅当存在一个 $v$ ,使得 $\gcd(a_i,v)=x$ 且 ${\rm lcm} (a_j,v)=y$ . 请你统计有多少合法的 $(i,j)$ 数对. $n\leq 2\times 10^5,1\leq x,y,a_i\le…
[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…
题目传送门 传送门I 传送门II 传送门III 题目大意 给定将$\left \{ 0, 1, \dots, m - 1\right \}$分成了不相交的两个非空集合$A$和$B$,给定$A$,问存在多少个整数$x$满足$0\leqslant x < m$且对于任意$a\in A, b \in B$满足$a + b\not \equiv x \pmod{m}$ 容易发现满足后一个条件的充分必要条件是对于任意$a \in A$,存在$a' \in A$使得$a + a' \equiv x \pmo…
http://codeforces.com/problemset/problem/615/D 题意 给出m个质因子,组成一个数n.问n的约数的乘积是多少,输出mod 1e+7的结果. 分析 从输入我们能知道这个数的所有质因子以及它们的个数.最后答案一定是ans=π p[i]^k[i] (p[i]为质因子,k[i]为最终乘积中的个数). 那么主要问题就是怎么求这个k[i]了.现在我们只关注一个质因子p,它的个数为num,那么其它质因子都有num[i]+1种可选择,根据乘法原理,当我们选定p时,其它…
n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-n…
http://codeforces.com/contest/932/problem/E 题意:   可以看做 有n种小球,每种小球有无限个,先从中选出x种,再在这x种小球中任选k个小球的方案数 选出的x种不一样,任选k个球的顺序不一样 均视做不同的方案 f[i][j] 表示选了i个小球,来自j种的方案数 那么答案就是 考虑选的第i个球是否是选过的一种, f[i][j]=f[i-1][j]*j+f[i-1][j-1]*(n-(j-1)) #include<cstdio> #include<…
E. Team Work time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have a team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people fo…
Discription It's the turn of the year, so Bash wants to send presents to his friends. There are n cities in the Himalayan region and they are connected by m bidirectional roads. Bash is living in city s. Bash has exactly one friend in each of the oth…
题目链接: codeforces 615 D. Multipliers 题目描述: 给出n个素数,这n个素数的乘积等于s,问p的所有因子相乘等于多少? 解题思路: 需要求出每一个素数的贡献值,设定在这n个素数中,有m个不同的素数,可表示为s = p1^a1*p1^a2*p3^a3*p4^a4.....pn^an,根据唯一分解定理可知,s的因子有(a1+1)*(a2+1)+......+(an+1) 个,对于pi的权值可以理解为:pi这个因子不出现,s的因子个数为x = (a1+1)*(a2+1)…
D. Basketball Team time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GU…