2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 M. Frequent Subsets Problem 题意:给定N和α还有M个U={1,2,3,...N}的子集,求子集X个数,X满足:X是U的子集且出现在M个子集中的次数>=α*M. 题解:因为N<=20,所以U的子集个数最大不过2^20.所以采用二进制把每个子集M映射压缩成一个数,比如: M={1,4,8,10}==>2^(1-0)+2^(4-1)+2^(8-1)+2^(10-1)=1+8+128+512=649(映射记为f,…
题意:给你n,m,让你求cos(nx)的展开式的(cos(x))^m项的系数. 更一般的式子是这样的:. 队友的代码: #include<cstdio> #include<algorithm> #include<queue> #include<set> using namespace std; long long n,k,i,ans; long long mo=998244353; long long ni(long long a,long long b)…
题意:一张有n个点的图,结点被编号为0~n-1,i往所有编号比它大的点j连边,权值为i xor j.给你n,问你最大流. 打个表,别忘了把相邻两项的差打出来,你会发现神奇的规律……你会发现每个答案都是由某些特定的数加起来组成的,最好把它们也打出来. #include<cstdio> using namespace std; typedef long long ll; #define MOD 1000000007ll ll n; int main(){ // freopen("e.ou…
题意:S(x)被定义为x的十进制表示下的数位之和.给你x,让你找一个正整数k,使得S(kx)能被233整除.k不超过2千位. 由于x不超过1000000,不论x是多少,10000000重复233次一定是合法的. #include<cstdio> using namespace std; int T,x; int main(){ scanf("%d",&T); for(;T;--T){ scanf("%d",&x); for(int i=1…
题意:投一枚硬币向上的概率是q/p.问你投K枚硬币,向上的枚数为偶数枚的概率是? 要求的即为. 这个东西是个二项展开式的偶数项系数和,来,我们复习一下高中数学,设f(x)=(ax+b)^n,则其偶数项系数和为(f(1)+f(-1))/2. #include<cstdio> using namespace std; typedef long long ll; #define MOD 1000000007ll int T; ll p,q,K; ll Quick_Pow(ll a,ll p,ll m…
题目链接:https://nanti.jisuanke.com/t/31453 After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show during the feast. To enjoy the show, every audience has to wear a Nogaku mask, and seat around as…
题目链接:https://nanti.jisuanke.com/t/31452 A prime number (or a prime) is a natural number greater than $1$ that cannot be formed by multiplying two smaller natural numbers. Now lets define a number $N$ as the supreme number if and only if each number m…