数论
文章平均质量分 82
Shicheng_Yang
这个作者很懒,什么都没留下…
展开
-
Ural 1086. Cryptography 筛素数
1086. CryptographyTime limit: 2.0 secondMemory limit: 64 MBWhile preparing this problem set the jury has run into the following problem: it was necessary to send by e-mail the texts of t原创 2013-07-30 15:46:54 · 1226 阅读 · 2 评论 -
Ural 1286. Starship Travel
1286. Starship TravelTime limit: 1.0 secondMemory limit: 64 MBIt is well known that a starship equipped with class B hyperengine is able to travel from any planet to any other planet. Bu原创 2013-08-06 09:54:11 · 1031 阅读 · 0 评论 -
Ural 1343. Fairy Tale
1343. Fairy TaleTime limit: 1.0 secondMemory limit: 64 MB12 months to sing and dance in a ring their celestial dance. One after another they hold a throne. The first is young and fierce原创 2013-08-06 14:38:35 · 991 阅读 · 0 评论 -
Ural 1554. Multiplicative Functions 狄利克雷卷积
1554. Multiplicative FunctionsTime limit: 2.0 secondMemory limit: 64 MBIn number theory, a multiplicative function is an arithmetic function F(n) of the positive integer nwith property t原创 2013-08-19 09:46:19 · 1777 阅读 · 0 评论 -
Ural 1456. Jedi Riddle 2 整数的阶
1456. Jedi Riddle 2Time limit: 0.25 secondMemory limit: 64 MBBackgroundEveryone wants to be respected and famous. At that many of us forget that most people became respected and famous原创 2013-08-19 11:26:58 · 761 阅读 · 0 评论 -
Ural 1132. Square Root 二次剩余
1132. Square RootTime limit: 1.0 secondMemory limit: 64 MBThe number x is called a square root of a modulo n (root(a,n)) if x*x = a (mod n). Write the program to find the square root o原创 2013-08-19 17:43:12 · 1189 阅读 · 0 评论 -
hdu 2824 The Eule Function 筛式欧拉函数
The Euler functionProblem DescriptionThe Euler function phi is an important kind of function innumber theory, (n) represents the amount of the numbers which aresmaller than n and coprime to n, an原创 2013-07-15 11:49:20 · 500 阅读 · 0 评论 -
Ural 1748. The Most Complex Number DFS+反素数
1748. The Most Complex NumberTime limit: 1.0 secondMemory limit: 64 MBLet us define a complexity of an integer as the number of its divisors. Your task is to find the most complex intege原创 2013-08-14 17:00:14 · 994 阅读 · 0 评论 -
Ural 1593. Square Country. Version 2 Lagrange 定理
1593. Square Country. Version 2Time limit: 1.0 secondMemory limit: 64 MBThere live square people in a square country. Everything in this country is square also. Thus, the Square Parliame原创 2013-08-14 20:05:06 · 1134 阅读 · 0 评论 -
Ural 1428. Jedi Riddle 二分求幂
1428. Jedi RiddleTime limit: 1.0 secondMemory limit: 64 MBBackgroundSystem administrator Vasily Slipman, also known as Jedi Master, was an outstanding jester. He enciphered gigabyte ar原创 2013-08-15 10:02:54 · 654 阅读 · 0 评论 -
Ural 1268. Little Chu 求原根
1268. Little ChuTime limit: 0.25 secondMemory limit: 64 MBThe favorite occupation of Little Chu is to sleep. Strictly speaking, he is busy with nothing but sleeping. Sometimes he wakes u原创 2013-08-15 18:35:12 · 818 阅读 · 0 评论 -
poj 1006 生理周期 中国剩余定理
生理周期Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 103623 Accepted: 32049Description人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会原创 2013-08-17 09:41:57 · 1222 阅读 · 0 评论 -
poj 2689 Prime Distance 二次筛法
Prime DistanceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10269 Accepted: 2772DescriptionThe branch of mathematics called number theory is about pro原创 2013-08-17 09:30:30 · 697 阅读 · 0 评论 -
hdu 3292 No more tricks, Mr Nanguo pell方程+矩阵快速幂
No more tricks, Mr NanguoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 201 Accepted Submission(s): 113Problem DescriptionNo原创 2013-08-17 10:01:18 · 787 阅读 · 0 评论 -
hdu 4196 Remoteland 基本算术定理
RemotelandTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 846 Accepted Submission(s): 305Problem DescriptionIn the Republi原创 2013-08-31 16:41:32 · 848 阅读 · 0 评论 -
Ural 1430. Crime and Punishment
1430. Crime and PunishmentTime limit: 0.5 secondMemory limit: 64 MBBackgroundPetty bureaucrat Victor Thiefton was disposed towards stealing from his childhood. But one thing is to lega原创 2013-08-05 16:50:00 · 1054 阅读 · 0 评论 -
Ural 1141. RSA Attack 扩展欧几里得算法
1141. RSA AttackTime limit: 1.0 secondMemory limit: 64 MBThe RSA problem is the following: given a positive integer n that is a product of two distinct odd primes p and q, a positive int原创 2013-08-03 15:53:30 · 1370 阅读 · 0 评论 -
poj 1061 青蛙的约会 扩展欧几里得算法
青蛙的约会Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 81439 Accepted: 14063Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面原创 2013-08-05 11:06:44 · 670 阅读 · 0 评论 -
Ural 1118. Nontrivial Numbers 求因子和
1118. Nontrivial NumbersTime limit: 2.0 secondMemory limit: 64 MBSpecialists of SKB Kontur have developed a unique cryptographic algorithm for needs of information protection while trans原创 2013-07-30 15:15:01 · 1293 阅读 · 0 评论 -
Ural 1352. Mersenne Primes 梅森素数
1352. Mersenne PrimesTime limit: 1.0 secondMemory limit: 64 MBDefinition. If the number 2N−1 is prime then it is called a Mersenne prime number.For example, 22−1 — the first Mersen原创 2013-07-30 21:38:28 · 1196 阅读 · 0 评论 -
Ural 1049. Brave Balloonists 求因子的个数
1049. Brave BalloonistsTime limit: 2.0 secondMemory limit: 64 MBTen mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celeb原创 2013-07-31 18:40:58 · 897 阅读 · 0 评论 -
Ural 1355. Bald Spot Revisited 质因数分解
1355. Bald Spot RevisitedTime limit: 1.0 secondMemory limit: 64 MBA student dreamt that he walked along the town where there were lots of pubs. He drank a mug of ale in each pub. All the原创 2013-07-31 20:56:35 · 777 阅读 · 0 评论 -
Ural 1091. Tmutarakan Exams 排列组合+容斥原理+质因数分解
1091. Tmutarakan ExamsTime limit: 1.0 secondMemory limit: 64 MBUniversity of New Tmutarakan trains the first-class specialists in mental arithmetic. To enter the University you should ma原创 2013-08-01 10:15:19 · 801 阅读 · 0 评论 -
Ural 1204. Idempotents 扩展欧几里得算法
1204. IdempotentsTime limit: 1.0 secondMemory limit: 64 MBThe number x is called an idempotent modulo n ifx*x = x (mod n)Write the program to find all idempotents modulo n, w原创 2013-07-31 19:29:37 · 1123 阅读 · 0 评论 -
hdu 1573 X问题 中国剩余定理
Problem Description 求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X moda[2] = b[2], …, X mod a[i] = b[i], … (0 < a[i] Input 输入数据的第一行为一个正整数T,表示有T组测试数据。每组测试数据的第一行为两个正整数N,M (0原创 2013-07-15 11:49:25 · 490 阅读 · 0 评论 -
Ural 1356. Something Easier 哥德巴赫猜想
1356. Something EasierTime limit: 1.0 secondMemory limit: 64 MB“How do physicists define prime numbers? Very easily: prime numbers are the number 2 and all the odd numbers greater than 2原创 2013-08-01 15:32:23 · 746 阅读 · 0 评论 -
素数筛法和测试
一。筛法线性时间筛法:一边制作质数表,一边删掉每个数的质数倍,时间复杂度就能达到O(N) 。const int N = 20000000 ;bool sieve [ N ]; void eratosthenes (){ vector prime ; for ( int i = 2 ; i < N ; i ++) {原创 2013-08-01 16:18:27 · 620 阅读 · 0 评论 -
质因数分解
算术基本定理Fundamental Theorem of Arithmetic凡是正整数都可以藉由质因数分解成为一个独一无二的式子,不同的n 就会对应不同的(n1, n2, … ) ,反方向亦同。根据算术基本定理,凡是牵扯到乘法、因数、倍数的数学运算,都可以改变成比较简单的运算。分解前| 分解后n | (n1, n2, ...)m | (m1, m2, ...)--原创 2013-08-01 16:22:44 · 1102 阅读 · 0 评论 -
最大公因数&&最小公倍数
最大公因数(Greatest Common Divisor)。多个数字共同都有的正因数当中最大的一个。int gcd ( int a , int b ){ int d ; for ( d = a ; !( a % d == 0 && b % d == 0 ); d --) ; return d ;}由于两个数必定是由最大公因数的整数倍所组合而成,原创 2013-08-01 16:03:58 · 943 阅读 · 0 评论 -
hdu 1787 GCDAgain Euler函数
GCD AgainProblem DescriptionDo you have spent some time to think and try to solve thoseunsolved problem after one ACM contest?No? Oh, you must do this when you want to become a "BigCattle".Now原创 2013-07-15 11:49:22 · 436 阅读 · 0 评论 -
欧拉函数
在数论中,对正整数n,欧拉函数\varphi(n)是小于或等于n的正整数中与n互质的数的数目。此函数以其首名研究者欧拉命名,它又称为φ函数、欧拉商数[来源请求]等。这是一个公式。计算1 到n 的正整数当中,跟n 互质(最大公因数是一)的数,总共有几个。首先要将n 做质因数分解:n = p 1 a 1 × p 2 a 2 × … × p k a k where p 1 … p k are原创 2013-08-01 20:35:14 · 1788 阅读 · 0 评论 -
Ural 1104. Don’t Ask Woman about Her Age
1104. Don’t Ask Woman about Her AgeTime limit: 1.0 secondMemory limit: 64 MBMrs Little likes digits most of all. Every year she tries to make the best number of the year. She tries to be原创 2013-07-30 14:05:52 · 1102 阅读 · 0 评论 -
poj 2115 C Looooops 扩展欧几里德算法
C LooooopsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 15305 Accepted: 3901DescriptionA Compiler Mystery: We are given a C-language style for loop of原创 2013-09-12 20:55:23 · 890 阅读 · 0 评论