bzoj 2277 [Poi2011]Strongbox 数论】的更多相关文章

2277: [Poi2011]Strongbox Time Limit: 60 Sec  Memory Limit: 32 MBSubmit: 527  Solved: 231[Submit][Status][Discuss] Description Byteasar is a famous safe-cracker, who renounced his criminal activity and got into testing and certifying anti-burglary dev…
题目大意:一个集合A,包含了0~n-1这n个数.另有一个集合B,满足: 1.B是A的子集. 2.如果a.b均在B中,则(a+b)%n也在B中(a=b亦可) 给出k个数ai,前k-1个不在B中,第k个在B中,问B最大有几个元素. 数据范围:1<=k<=250000,k<=n<=1e14; (以下x,y均代表互不相关的整数) 考虑集合B. 假设B中有一元素v.则方程 v*x-n*y=c(即v*x与c对n同余)当且仅当gcd(v,n)|c 时有正整数解x,y. 那么显然c=gcd(v,n…
题意 有一个密码箱,\(0\)到\(n-1\)中的某些整数是它的密码.如果\(a\)和\(b\)都是它的密码,那么\((a+b)%n\)也是它的密码(\(a,b\)可以相等).某人试了\(k\)次密码,前\(k-1\)次都失败了,最后一次成功了.该密码箱最多有多少不同的密码. 分析 假设集合\(s\)为答案,则令\(g=gcd(s_i)\),则显然\(kg, k \ge 0\)都是答案.一共有\(\frac{n}{g}\)个. 所以我们找一个最小的\(g\),满足\(g|n, g|a_n, g…
题目描述 Byteasar is a famous safe-cracker, who renounced his criminal activity and got into testing and certifying anti-burglary devices. He has just received a new kind of strongbox for tests: a combinatorial safe. A combinatorial safe is something dif…
2277: [Poi2011]Strongbox Time Limit: 60 Sec  Memory Limit: 32 MBSubmit: 498  Solved: 218[Submit][Status][Discuss] Description Byteasar is a famous safe-cracker, who renounced his criminal activity and got into testing and certifying anti-burglary dev…
bzoj 4176 Lucas的数论 和约数个数和那题差不多.只不过那个题是多组询问,这题只询问一次,并且 \(n\) 开到了 \(10^9\). \[ \begin{align*} \sum_{i=1}^N \sum_{j=1}^N f(ij)&= \sum_{i=1}^N \sum_{j=1}^N \sum_{x|i} \sum_{y|j}[gcd(x,y)=1]\\&= \sum_{i=1}^N \sum_{j=1}^N \sum_{x|i} \sum_{y|j} \sum_{d|g…
BZOJ 2530 Poi2011 Party Description Byteasar intends to throw up a party. Naturally, he would like it to be a success. Furthermore, Byteasar is quite certain that to make it so it suffices if all invited guests know each other. He is currently trying…
[bzoj 2216] [Poi2011] Lightning Conductor Description 已知一个长度为n的序列a1,a2,-,an. 对于每个1<=i<=n,找到最小的非负整数p满足 对于任意的j, aj < = ai + p – sqrt(abs(i-j)) Input 第一行n,(1<=n<=500000) 下面每行一个整数,其中第i行是ai.(0<=ai<=1000000000) Output n行,第i行表示对于i,得到的p Sampl…
下文中所有讨论都在数论函数范围内开展. 数论函数指的是定义域为正整数域, 且值域为复数域的函数. 数论意义下的和式处理技巧 因子 \[ \sum_{d | n} a_d = \sum_{d | n} a_{\frac n d} \] 双重因子 \[ \sum_{k | n} \sum_{j | k} a_{k, j} = \sum_{k | n} \sum_{j | \frac n k} a_{jk, k} \] \[ \sum_{n | k} \sum_{k | j} a_{k, j} = \…
·问题描述· 有一个密码箱,0到n-1中的某些数是它的密码.且满足:如果a和b都是它的密码,那么(a+b)%n也是它的密码.某人试了k次密码,前k-1次都失败了,最后一次成功. 问:该密码箱最多有多少个密码? ·输入格式· 输入第一行两个整数分别表示n,k. 第二行为k个用空格隔开的非负整数,表示每次试的密码.(数据保证存在合法解) ·输出格式· 输出一行一个数,表示结果. ·输入样例· 42 5 28 31 10 38 24 ·输出样例· 14 ·数据范围· 对于100%的数据:1<=k<=…