![](https://img-blog.csdnimg.cn/20200414014020557.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
ICPC-数论
文章平均质量分 76
有关数论问题的题解
海岛Blog
专注于程序设计及其竞赛,专注于集成电路EDA设计
展开
-
HDU5976 LA7728 Detachment【逆元+前缀和+二分】
DetachmentTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 6903 Accepted Submission(s): 1918Problem DescriptionIn a highly developed alien society, the habitats are almost infinite dimensional s原创 2021-08-08 17:31:03 · 188 阅读 · 0 评论 -
UVA10880 Colin and Ryan【整除】
“As a special bonus, if they orderby midnight, what would they receive?Colin: They’d receive it earlier than ifthey’d ordered it later.Songs of the Butcher Colin and Ryan had a party. They baked C cookies and invited G guests. E原创 2021-05-30 05:40:54 · 244 阅读 · 0 评论 -
HDU2815 Mod Tree【大步小步法】
Mod TreeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8555 Accepted Submission(s): 1992Problem DescriptionThe picture indicates a tree, every node has 2 children.The depth of the nodes whos原创 2021-05-20 07:30:47 · 217 阅读 · 0 评论 -
POJ3243 Clever Y【大步小步法】
Clever YTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 11799 Accepted: 2932DescriptionLittle Y finds there is a very interesting formula in mathematics:XYmodZ=KX^Y mod Z = KXYmodZ=KGiven X, Y, Z, we all know how to figure out K fast. How原创 2021-05-18 06:27:10 · 287 阅读 · 0 评论 -
UVA11549 Calculator Conundrum【循环节】
Alice got a hold of an old calculator that can display n digits. She was bored enough to come up with the following time waster. She enters a number k then repeatedly squares it until the result overflows. When the result overflows,原创 2021-05-09 21:09:58 · 159 阅读 · 0 评论 -
UVA1230 LA4104 MODEX【快速模幂】
Many well-known cryptographic operations require modular exponentiation. That is, given integers x, y and n, compute xy mod n. In this question, you are tasked to program an efficient way to execute this calculation.InputThe input consists of a line cont原创 2021-04-10 18:19:28 · 315 阅读 · 0 评论 -
UVA10219 Find the ways!【数学】
An American, a Frenchman and an Englishwoman had been to Dhaka, the capital of Bangladesh. They went sight-seeing in a taxi. The three tourists were talking about the sites in the city. The American was very proud of tall buildings in New York. He boasted原创 2021-02-23 11:07:58 · 229 阅读 · 0 评论 -
UVA10407 Simple division【同余+一阶差分】
Integer division between a dividend n and a divisor d yields a quotient q and a remainder r. q is the integer which maximizes q ∗ d such that q ∗ d ≤ n and r = n − q ∗ d. For a...原创 2020-03-11 21:44:18 · 1289 阅读 · 0 评论 -
UVA10948 The primary problem【欧拉筛法+贪心】
Larry now lost most of his knowledge after spending a few years on deserted islands all over the place. When Ryan brought up the fact that every even number greater than 3 can represented as the sum o...原创 2020-02-27 19:58:22 · 333 阅读 · 0 评论 -
HDU3792 Twin Prime Conjecture【筛选法+前缀和】
Twin Prime ConjectureTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4300 Accepted Submission(s): 1652Problem DescriptionIf we define dn ...原创 2020-02-26 13:29:19 · 565 阅读 · 0 评论 -
HDU6608 Fansblog【Miller_Rabin素性测试算法+威尔逊定理】
FansblogTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2801 Accepted Submission(s): 1158Problem DescriptionFarmer John keeps a website c...原创 2020-02-21 22:11:56 · 325 阅读 · 0 评论 -
HDU2138 How many prime numbers【Miller_Rabin素性测试算法】
How many prime numbersTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 28963 Accepted Submission(s): 9629Problem DescriptionGive you a lot...原创 2020-02-21 21:04:13 · 296 阅读 · 1 评论 -
POJ3641 UVA11287 HDU1905 Pseudoprime numbers【素数判定+快速模幂+Miller_Rabin素性测试算法】
Pseudoprime numbersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 15471 Accepted: 6696DescriptionFermat’s theorem states that for any prime number p and for any integer a > 1, ap =...原创 2020-02-20 22:04:14 · 335 阅读 · 0 评论 -
HDU5150 Sum Sum Sum【筛选法】
Sum Sum SumTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1524Accepted Submission(s): 893Problem DescriptionWe call a po...原创 2016-09-02 10:02:12 · 932 阅读 · 0 评论 -
UVA11040 Add bricks in the wall【数学】
This in not “another brick in the wall”, it’s just a matter of adding numbers. Suppose you have a wall with the shape of a triangle, like the one shown below. The wall has 9 rows and row i has exactly...原创 2018-04-06 11:01:40 · 548 阅读 · 0 评论 -
HDU1019 ZOJ1797 Least Common Multiple【最小公倍数】
Least Common MultipleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 59471 Accepted Submission(s): 22683Problem DescriptionThe least common m...原创 2018-03-22 08:43:52 · 442 阅读 · 0 评论 -
UVA10090 Marbles【扩展欧几里得算法】
I have some (say, n) marbles (small glass balls) and I am going to buy some boxes to store them. The boxes are of two types:Type 1: each box costs c1 Taka and can hold exactly n1 marblesType 2: each b...原创 2018-02-23 17:06:52 · 787 阅读 · 0 评论 -
POJ2649 ZOJ1850 UVA10139 Factovisors【筛选法+勒让德定理】
FactovisorsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4511 Accepted: 1116DescriptionThe factorial function, n! is defined thus for n a non-negative integer: 0! = 1 n! = n * (n-1)...原创 2018-02-23 12:00:44 · 586 阅读 · 0 评论 -
UVA583 UVALive5406 Prime Factors【素数因子+筛选法】
Webster defines prime as:prime (pr¯im) n. [ME, fr. MF, fem. of prin first, L primus; akin to L prior] 1: first in time: original 2 a: having no factor except itself and one ⟨3 is a ∼ number⟩ b : havin...原创 2018-02-20 08:59:44 · 679 阅读 · 0 评论 -
UVA294 UVALive5595 Divisors【正因子数】
Mathematicians love all sorts of odd properties of numbers. For instance, they consider 945 to be an interesting number, since it is the first odd number for which the sum of its divisors is larger th...原创 2018-02-17 07:00:01 · 701 阅读 · 0 评论 -
UVA160 Factors and Factorials【筛选法】
The factorial of a number N (written N!) is defined as the product of all the integers from 1 to N. It is often defined recursively as follows:1! = 1N! = N ∗ (N − 1)! Factorials grow very rapidly — 5...原创 2018-06-17 20:26:17 · 452 阅读 · 0 评论 -
HDU1420 Prepared for New Acmer【快速模幂】
Prepared for New AcmerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12296 Accepted Submission(s): 4734Problem Description集训进行了将近2个礼拜,这段时间以恢...原创 2018-07-12 10:54:43 · 655 阅读 · 0 评论 -
POJ1061 青蛙的约会【扩展欧几里得算法】
青蛙的约会Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 126746 Accepted: 27392 Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前...原创 2018-07-22 06:22:12 · 708 阅读 · 0 评论 -
HDU5363 Key Set【快速模幂】
Key SetTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2757 Accepted Submission(s): 1380 Problem Descriptionsoda has a set S with n...原创 2018-08-17 20:52:24 · 316 阅读 · 0 评论 -
POJ3518 UVA1644 UVALive3883 Prime Gap【筛选法+打表】
Prime GapTime Limit: 5000MS Memory Limit: 65536K Total Submissions: 10713 Accepted: 6165 DescriptionThe sequence of n − 1 consecutive composite numbers (positive integers that ...原创 2018-08-08 22:02:19 · 356 阅读 · 0 评论 -
HDU1097 A hard puzzle【快速模幂+数学规律】
A hard puzzleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 52171 Accepted Submission(s): 19072Problem Descriptionlcy gives a hard puzzl...原创 2018-12-30 21:30:38 · 372 阅读 · 1 评论 -
ZOJ1823 UVA10392 Factoring Large Numbers【因子】
One of the central ideas behind much cryptography is that factoring large numbers is computationally intensive. In this context one might use a 100 digit number that was a product of two 50 digit prim...原创 2019-02-21 14:03:26 · 331 阅读 · 0 评论 -
UVA10061 How many zero's and how many digits ?【不同进制因子分解】
Given a decimal integer number you will have to find out how many trailing zeros will be there in its factorial in a given number system and also you will have to find how many digits will its factori...原创 2019-02-21 14:39:31 · 352 阅读 · 0 评论 -
UVA10791 Minimum Sum LCM【唯一分解定理】
LCM (Least Common Multiple) of a set of integers is defined as the minimum number, which is a multiple of all integers of that set. It is interesting to note that any positive integer can be expressed...原创 2019-03-02 23:49:08 · 513 阅读 · 0 评论 -
UVa10006 Carmichael Numbers【素数判定+快速模幂】
问题链接:UVa10006 Carmichael Numbers。问题简述:参见上述链接。问题分析:这是一个卡尔迈勒数判定问题,只要读懂题意就简单了。卡尔迈勒数是数论中的一个重要概念。程序说明:函数isprime()不是一个真正意义上的素数判断函数,只进行奇数判定,对于本题条件是没有问题的。函数powermod()是模幂计算函数。AC的C++语言原创 2017-05-20 19:29:50 · 1164 阅读 · 0 评论 -
UVA10699 Count the factors【素数因子个数+筛选法】
Write a program, that computes the number of different prime factors in a positive integer.InputThe input tests will consist of a series of positive integers. Each number is on a line on its own. The ...原创 2018-02-13 00:02:06 · 516 阅读 · 0 评论 -
UVA10831 Gerg's Cake【快速幂+勒让德记号】
Gerg is having a party, and he has invited his friends. p of them have arrived already, but a are running late. To occupy his guests, he tried playing some team games with them, but he found that it w...原创 2018-02-12 21:15:09 · 409 阅读 · 0 评论 -
HDU1018 POJ1423 UVALive2697 UVA1185 ZOJ1526 Big Number【阶乘位数】
Big NumberTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 28524 Accepted: 9075DescriptionIn many applications very large integers numbers are required.原创 2017-11-15 05:09:15 · 766 阅读 · 0 评论 -
HDU1395 ZOJ1489 2^x mod n = 1【暴力法+数论】
2^x mod n = 1Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17824 Accepted Submission(s): 5582Problem DescriptionGive a number n原创 2017-09-05 21:28:34 · 1137 阅读 · 0 评论 -
POJ1142 HDU1333 ZOJ1133 Smith Numbers【质因数分解+素数判定+数位之和】
问题链接:POJ1142 HDU1333 ZOJ1133 Smith Numbers。题意简述:寻找大于输入数并且最接近的Smith Numbers。问题分析:Smith Numbers数不是素数,其各位数字之和等于其各个因子的各位数字之和。。程序说明:函数digitsum()用于计算数的各位数字之和。函数fact_digitsum用于计算数的各个因子的数字之和,但原创 2017-05-20 18:01:48 · 1588 阅读 · 1 评论 -
ZOJ1160 Biorhythms【中国剩余定理】
BiorhythmsTime Limit: 10 Seconds Memory Limit: 32768 KBSome people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the原创 2017-06-14 22:19:55 · 827 阅读 · 0 评论 -
HDU1370 Biorhythms【中国剩余定理】
问题链接:HDU1370 Biorhythms。问题描述:参见上文。问题分析:本题可以直接用中国剩余定理来解,同余方程如下:X≡p(mod 23)X≡e(mod 28)X≡i(mod 33)其中,23、28和33是两两互素的,满足中国剩余定理的前提条件。程序说明:这个题的原题应该是UVALive5421。这个题与《POJ1006 UVA756 UVALi原创 2017-05-12 23:36:11 · 1151 阅读 · 0 评论 -
POJ1995 ZOJ2150 Raising Modulo Numbers【快速模幂】
Raising Modulo NumbersTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 8010 Accepted: 4875DescriptionPeople are different. Some secretly read magazines f原创 2017-05-20 05:00:40 · 916 阅读 · 0 评论 -
HDU1492 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): 4105 Accepted Submission(s): 2012Pro原创 2017-06-21 06:23:34 · 683 阅读 · 0 评论 -
UVALive2203 UVa10042 Smith Numbers【质因数分解+素数判定+数位之和】
While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University, noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property:...原创 2017-05-20 18:09:00 · 1273 阅读 · 0 评论