![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
文章平均质量分 61
qwe585p
这个作者很懒,什么都没留下…
展开
-
UVA 12169 Disgruntled Judge(暴力)
题意:有个裁判根据公式(a * xi + b)% 10001,打印了好多数据, 现在给你下标为单数的数据, 让你求出剩下下标双数的数据。 解题思路:暴力枚举a,b, 判断是否与已知矛盾。 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3321原创 2015-10-27 08:23:08 · 453 阅读 · 0 评论 -
UVA 10791 Minimum Sum LCM(唯一分解定理)
题意: 输入一个整数n, 求至少两个正整数,使他们的LCM是n, 且让整数和尽可能的小。 解题思路: 将n使用唯一分解定理分解,每位上每个素因子根据指数, 算出它的幂, 加起来就是最小的和。 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=原创 2015-10-27 08:57:10 · 330 阅读 · 0 评论 -
UVA 12716 GCD XOR(猜想)
题意: 输入整数n,能使a,b 解题思路: 枚举,a, c, b = a -c, 验证是否有 c = a ^ b, 打表预处理。 Description Given an integer N, nd how many pairs (A; B) are there such that: gcd(A; B) = A xor B where 1 B A N原创 2015-10-27 09:04:58 · 344 阅读 · 0 评论 -
UVA 11582 Colossal Fibonacci Numbers!(模运算)
题意:对A的B次方项斐波那契序列求余。 解题思路:根据递推关系找到余数的循环周期, 再利用快速求余确定位置。 注意n = 0, 和 1的情况 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=26 #include #incl原创 2015-10-27 08:19:01 · 359 阅读 · 0 评论 -
UVA 10375 Choose and divide(组合数运算)
题意:运算两个组合数的商。 解题思路:根据唯一分解定理分解阶乘,相互约掉素因子,最后再根据素因子各个位置上的指数算出答案。 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1316 #include #include #inclu原创 2015-10-27 08:26:26 · 335 阅读 · 0 评论 -
UVA 1210 Sum of Consecutive Prime Numbers(素数打表)
题意:给定一个整数n, 问有多少个若干个连续的素数的和为n。 解题思路:打出MAX_N以内的素数表, 枚举即可。 Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given原创 2015-11-01 21:32:13 · 763 阅读 · 0 评论 -
UVA 10539 Almost Prime Numbers(唯一分解定理)
题意:在区间[l, u]内找出有多少只有一个素因子的数, 且本身不是素数。 解题思路:直接使用唯一分解定理会导致超时, 所以可以将每个素因子累乘,在[l, u]内寻找有多少个,需要注意的是因为要用到int与long long 运算所以要把素数表开成long long Almost prime numbers are the non-prime numbers which are divisib原创 2015-11-01 21:37:54 · 699 阅读 · 0 评论 -
UVA 294 Divisors(唯一分解定理 + 除数函数)
题意:在给定区间[l, u]求因数最多的整数。 解题思路:素数打表, 一个个枚举求因数最多的数。 Mathematicians love all sorts of odd properties of numbers. For instance, they consider 945 to be an interesting number, since it is the first od原创 2015-11-01 21:48:56 · 739 阅读 · 0 评论 -
UVA 10622 Perfect P-th Powers (唯一分解定理 + GCD)
题意:找所给定的一个数变成x的p次方的形式, 寻找P最大是多少。 解题思路:先使用唯一分解定理分解素因子, 然后再求所有素因子在一起的GCD,注意负数的P不能为偶数只能为奇数。边分解边求GCD, 否则可能超时。 We say that x is a perfect square if, for some integer b, x = b 2 . Similarly, x is a per原创 2015-11-01 21:45:00 · 494 阅读 · 0 评论