ACM_其他数论
文章平均质量分 88
LzyRapX
Just For Fun .
展开
-
HDU 5628 Clarke and math (Dirichlet卷积)
题目链接: HDU 5628题意: 给你f(i)。(i=1,2,…,n)f(i)。(i=1,2,…,n) 求g(i)=∑i1∣i∑i2∣i1∑i3∣i2⋯∑ik∣ik−1f(ik) mod 1000000007(1≤i≤n)\displaystyle g(i) = \sum_{i_1 \mid i} \sum_{i_2 \mid i_1} \sum_{i_3 \mid i_2} \cdots原创 2017-09-03 14:08:54 · 4155 阅读 · 0 评论 -
Project euler 401 约数的平方和 (数论)
题意:约数的平方和6的约数有1、2、3和6。这些数的平方和是1+4+9+36=50。我们记sigma2(n)是n的所有约数的平方和。因此sigma2(6)=50.我们记SIGMA2是sigma2的和函数,也就是说SIGMA2(n)=∑sigma2(i),其中i=1~n。SIGMA2的前6项为:1、6、16、37、63和113。求SIGMA2(10原创 2017-02-27 21:41:45 · 1682 阅读 · 1 评论 -
PE 131 Prime cube partnership (数论)
Prime cube partnershipProblem 131There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.For example, when p = 1原创 2017-01-10 22:11:12 · 572 阅读 · 0 评论 -
关于Pell方程及其求解技巧
Pell方程在不定方程里经常出现,解其他方程的时候最后往往归结为对某个pell方程的讨论。本文不加证明的叙述几个pell方程的结论,并讨论怎么用连分数来具体算出特定pell方程的解。Pell方程,一般是指x^2-dy^2=1.①定理1:设d是一个正整数且不是一个完全平方,则方程①有无穷多组整数解x,y.设a^2-db^2=1,a>0,b>0,是所有x>0,y>0的解中使x+y√原创 2016-11-13 01:17:10 · 11142 阅读 · 1 评论 -
PE 233 Lattice points on a circle (数论:毕格拉斯三元组(勾股数))
Lattice points on a circle Problem 233 Let f(N) be the number of points with integer coordinates that are on a circle passing through (0,0), (N,0),(0,N), and (N,N). It can be shown that f(10000) = 3原创 2016-12-26 23:52:31 · 1188 阅读 · 0 评论 -
PE 108 Diophantine reciprocals I (数论:分式个数)
PE108 分式1a+1b=1n\dfrac{1}{a}+\dfrac{1}{b}=\dfrac{1}{n}的不同个数其实就是1+d(n2)2\dfrac{1+d(n^2)}{2},其中d(n)d(n)是nn的约数个数。证明:1b=1n−1a=a−nan\dfrac{1}{b}=\dfrac{1}{n}-\dfrac{1}{a}=\dfrac{a-n}{an}==>==>b=ana−nb=\dfr原创 2016-12-24 17:15:20 · 555 阅读 · 0 评论 -
PE Problem 95 Amicable chains (分解因子和)
Amicable chainsProblem 95The proper divisors of a number are all the divisors excluding the number itself. For example, the proper divisors of 28 are 1, 2, 4, 7, and 14. As the sum of thes原创 2016-11-25 21:26:24 · 427 阅读 · 0 评论 -
16哈理工新生赛 D 陈月亮的数学题 (数论)
题目链接:点击打开题目链接陈月亮的数学题 Time Limit: 2000 MS Memory Limit: 32768 K Total Submit: 102(27 users) Total Accepted: 46(23 users) Rating: Special Judge: No Description 陈月亮从小就热爱数学,这天老师讲到任何一个正整数N,我们可以很容易的找出原创 2016-12-07 18:22:07 · 1086 阅读 · 0 评论 -
Problem 100 Arranged probability (丢番图方程)
Arranged probabilityProblem 100If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the pr原创 2016-11-23 15:28:13 · 1505 阅读 · 0 评论 -
PE 121 Disc game prize fund (第一类斯特林)
Disc game prize fundProblem 121A bag contains one red disc and one blue disc. In a game of chance a player takes a disc at random and its colour is noted. After each turn the disc is returned to the ba原创 2016-12-10 12:57:34 · 652 阅读 · 0 评论 -
PE 71 72 73 Farey Neighbours (sequence) (farey序列)
我们假设,然后,向不等式两边加上,原创 2016-11-14 14:15:33 · 583 阅读 · 0 评论 -
除法取模 逆元 费马小定理
对于正整数和,如果有,那么把这个同余方程中的最小正整数解叫做模的逆元。逆元一般用扩展欧几里得算法来求得,如果为素数,那么还可以根据费马小定理得到逆元为。(都要求a和m互质)推导过程如下(摘自Acdreamer博客) 假如p是质数,且gcd(a,p)=1,那么 a(p-1)≡1(mod p)这个为费马小定理,m为素数是费马小定理的前置条件。原创 2017-02-22 23:17:34 · 1967 阅读 · 0 评论 -
PE 101 Optimum polynomial(拉格朗日插值)
Optimum polynomialProblem 101If we are presented with the first k terms of a sequence it is impossible to say with certainty the value of the next term, as there are infinitely many polyno原创 2016-12-11 19:45:37 · 1056 阅读 · 0 评论 -
2017 Multi-University Training Contest - 第二场 07 If the starlight never fade (数论)
题目链接: HDU 6051题意: f(i) f(i) 表示满足(x+y) i ≡x i %p (x+y)^{i}≡x^{i}\% p 中 (x,y) (x,y) 的对数,其中,1≤x≤p−1,1≤y≤m. 1≤x≤p−1,1≤y≤m. 给你一个非负数 m m 和素数 p p,让你求∑ p−1 i=1 if(i) \sum_{i=1}^{p-1}if\left(i\right),答案mo原创 2017-07-27 23:00:02 · 680 阅读 · 0 评论 -
ACdream 1006 Mengzhu (数学推导)
题目链接: ACdream 1006题意: 题解:纯数学推导。 因为: log2(x+y)=Alog2(x+y)=A log2(x−y)=Blog2(x-y)=B 所以, 2A=x+y2^{A} = x+y 2B=x−y2^{B} = x-y相加一下,2x=2A+2B2x=2^{A}+2^{B} 所以,x=2A+2B2=2A−1+2B−1x=\frac{2^{A}+2^{B原创 2017-06-23 15:51:33 · 379 阅读 · 0 评论 -
ACdream 1007 a + b (数学+快速幂)
题目链接: ACdream 1007 题目: 题解:不说了….看代码吧…AC代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;const ll mod = 10000000007LL;ll q_mod(ll a, ll b) //a^b { ll ans = 0; while(b)原创 2017-06-22 18:22:03 · 483 阅读 · 0 评论 -
PE 110 Diophantine reciprocals II (数论:分式个数)(加强版)(dfs)
PE 110题目 PE 108 题解从PE 108 我们可以知道,分式 1a+1b=1n\dfrac{1}{a}+\dfrac{1}{b}=\dfrac{1}{n} 的个数 就是1+d(n2)2\dfrac{1+d(n^2)}{2},其中d(n)d(n)是n的约数的个数。、而 PE 110 只是PE 108的加强版。用PE 108的方法 换个方式就可以了。 比如:n=2p13p25p3.....原创 2016-12-26 23:13:14 · 640 阅读 · 0 评论 -
ACdream 1084 寒假安排 (数学题)
题目链接: ACdream 1084题解: 就是让你求A(n,m)A(n,m)的KK进制下末尾0的个数。 将KK进行素因子分解,然后计算每个素因子在n!−(n−m)! n! - (n - m)!的指数,那么每个素因子在n!−(n−m)! n! - (n - m)! 中的指数除以KK 分解出来的指数,取其最小值就是答案了。AC代码:#include <bits/stdc++.h>using n原创 2017-06-19 23:52:54 · 374 阅读 · 0 评论 -
ACdream 1077 LCM Challenge (数学题)(LCM)
题目链接: ACdream 1077题解: 要使LCMLCM最大,那么显然就是要gcd(gcd(a,b)∗gcd(b,c)∗gcd(a,c))=1gcd(gcd(a,b)*gcd(b,c)*gcd(a,c))=1,如果nn是奇数,那么答案显然是n∗(n−1)∗(n−2)n*(n-1)*(n-2)。 如果nn是偶数,且n%3=1n\%3=1时,答案显然是n∗(n−1)∗(n−3)n*(n-1)*原创 2017-06-19 14:52:13 · 333 阅读 · 0 评论 -
HDU 2197 本原串 (数学+容斥)
题目链接: HDU 2197题意: 由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)n(n<=100000000)的本原串? 答案mod2008\mod2008. 例如,100100100100不是本原串,因为他是由两个100100组成,而11011101是本原串。题解: 我们考虑一下容斥原理,长度为nn的01串的总数为2原创 2017-06-02 13:45:31 · 495 阅读 · 0 评论 -
51nod 1135 原根 (数论)
题目链接: 原根例题求模素数$P$原根的方法:对素因子分解,即是$P-1$的标准分解式,若恒有 成立,则就是的原根。(对于合数求原根,只需把换成即可)。代码:#include<bits/stdc++.h> using namespace std;int p[100010];int t = 0;//http://blog.csdn.net/acdreamers/article/detail原创 2017-05-20 14:02:06 · 553 阅读 · 0 评论 -
#10 C. Digital Root (数论)
题目链接: 点击打开链接 http://codeforces.com/contest/10/problem/C 题意: 定义d(x)d(x)为xx的数字根,找出nn以内的满足d(z)=d(d(x)⋅d(y))d(z)=d(d(x)⋅d(y))但不满足x⋅y=zx⋅y=z这样的x,y,zx,y,z有多少组? d(A)d(A)是数根,其实就是AA%9. 题解: 容斥,首先把所有的d(A)d原创 2017-04-28 16:46:10 · 544 阅读 · 0 评论 -
Problem S4: Interesting Numbers 加强版 (数论)
Problem Description We call a number interesting, if and only if: 1. Its digits consists of only 0, 1, 2 and 3, and all these digits occurred at least once. 2. Inside this number, all 0s occur befor原创 2017-03-30 10:12:24 · 1123 阅读 · 0 评论 -
PE 66 Diophantine equation(Pell方程)
Diophantine equationProblem 66Consider quadratic Diophantine equations of the form:x2 – Dy2 = 1For example, when D=13, the minimal solution in x is 6492 – 13×1802 = 1.It can be ass原创 2016-11-12 20:15:43 · 885 阅读 · 0 评论 -
Problem 23 Non-abundant sums (盈数)
Non-abundant sumsProblem 23A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be原创 2016-10-28 13:42:15 · 524 阅读 · 1 评论 -
多项式求解(霍纳规则(Horner Rule))
1、霍纳规则(Horner Rule)(算法导论第二章23页左右)霍纳规则是采用最少的乘法运算策略,求多项式在x处的值,该规则为。利用该规则,可以求任意多项式的在x处的值。2、实现代码:int horner(int *a, int n,int x) //霍纳规则{ int ax = a[n] * x + a[n - 1]; //求出在内层括号内的值原创 2016-08-08 23:33:39 · 2548 阅读 · 1 评论 -
教你一波Lucas(卢卡斯)定理在数论解题中的应用
首先,Lucas(卢卡斯)定理是什么?有什么用?Lucas定理是用来求 C(n,m) mod p,p为素数的值。(注意:p一定是素数)有人会想,C(n,m)不能用C(n, m) = C(n - 1,m) + C(n - 1, m - 1)的公式来递推吗?( 提示:C(n, m) mod p = n!/(m!(n - m)!) mod p )可以是可以。但当n原创 2016-08-05 22:48:51 · 12148 阅读 · 3 评论 -
HDU 5734 Acperience (数学)
AcperienceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1051 Accepted Submission(s): 564Problem DescriptionDeep neural networks (原创 2016-08-02 17:04:13 · 622 阅读 · 0 评论 -
HDU 5794 A Simple Chess (容斥+Lucas定理)
A Simple Chess题目链接:点我打开链接AuthorUESTCSource2016 Multi-University Training Contest 6题意:规定起始点(1,1),要求到达(n,m),下一步(x2,y2),这一步(x1,y1),并且这两点坐标要求满足(x2-x1)^2 +(y2-y1)^2 = 5,且 x2>x1 、y2>y1。中原创 2016-08-05 17:17:48 · 655 阅读 · 2 评论 -
HDU 5728 PowMod (欧拉函数+指数循环节)
PowMod (点击打开题目)Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 840 Accepted Submission(s): 291Problem DescriptionDeclare:k=∑mi=原创 2016-08-02 14:06:27 · 1200 阅读 · 0 评论 -
HDU 2086 A1 = ? (数学归纳)
A1 = ?Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7054 Accepted Submission(s): 4388Problem Description有如下方程:Ai = (Ai-1 + Ai+1)/原创 2016-07-20 23:56:10 · 530 阅读 · 0 评论 -
HDU 1999 不可摸数 (约数和。。)
不可摸数Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11521 Accepted Submission(s): 3000Problem Descriptions(n)是正整数n的真因子之和,即小于n且整除n原创 2016-07-20 17:06:09 · 802 阅读 · 0 评论 -
HDU 1492 The number of divisors(约数) about Humble Numbers (约数个数)
The number of divisors(约数) about Humble NumbersTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3368 Accepted Submission(s): 1653Pro原创 2016-07-19 14:59:57 · 608 阅读 · 0 评论 -
HDU 2040 亲和数(约数模拟)
亲和数Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 32583 Accepted Submission(s): 19662Problem Description古希腊数学家毕达哥拉斯在自然数研究中发现,220原创 2016-05-02 21:08:16 · 631 阅读 · 0 评论 -
HDU 5747 BestCoder Round #84 Aaronson (模拟)
AaronsonTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 346 Accepted Submission(s): 210Problem DescriptionRecently, Peter saw the原创 2016-07-24 12:38:06 · 709 阅读 · 0 评论 -
Codeforces Round #368 (Div. 2) C. Pythagorean Triples(数学构造)
C. Pythagorean Triplestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKatya studies in a fifth grade. Recen原创 2016-08-21 22:58:47 · 949 阅读 · 0 评论 -
Educational Codeforces Round 15 D. Road to Post Office (数学)
D. Road to Post Officetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasiliy has a car and he wants to get原创 2016-08-10 23:15:14 · 670 阅读 · 0 评论 -
Problem 21 Amicable numbers (分解因子和)
Amicable numbersProblem 21Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).If d(a) = b and d(b) = a, where a ≠ b, then a and b are原创 2016-10-27 23:12:05 · 587 阅读 · 0 评论 -
快速计算分解因子和
How do you work out the sum of divisors?Imagine you wish to work out the sum of divisors of the number 72. It would not take long to list the divisors, and then find their sum: 1 + 2 + 3 + 4 + 6 +原创 2016-10-27 22:48:50 · 667 阅读 · 0 评论 -
PE 65 Convergents of e (e的无限逼近)
Convergents of eProblem 65The square root of 2 can be written as an infinite continued fraction.√2 = 1 +12 +12 +12 +原创 2016-11-07 22:38:02 · 1089 阅读 · 0 评论