数论
离墨猫
这个作者很懒,什么都没留下…
展开
-
nefu117 素数个数的位数 素数定理+位数公式
素数个数的位数Time Limit 1000msMemory Limit 65536Kdescription小明是一个聪明的孩子,对数论有着非常浓烈的兴趣。他发现求1到正整数10n 之间有多少个素数是一个非常难的问题,该问题的难以决定于n 值的大小。如今的问题是,告诉你n的值,让转载 2017-08-01 10:51:05 · 454 阅读 · 0 评论 -
POJ 3233 Matrix Power Series(矩阵快速幂+二分求解)
Matrix Power SeriesTime Limit: 3000MS Memory Limit: 131072KTotal Submissions: 24316 Accepted: 10110DescriptionGiven a n × n matrix A and a positive integer k, fin原创 2017-09-06 21:16:58 · 208 阅读 · 0 评论 -
求两个或N个数的最大公约数(gcd)和最小公倍数(lcm)的较优算法
#include #include using namespace std;int gcd(int a, int b);int ngcd(int *a, int n);int lcm(int a, int b);int nlcm(int *a, int n);int main(){ //int a,b; //cin >> a >> b; //cout << lcm(a,转载 2017-08-24 10:00:38 · 455 阅读 · 0 评论 -
HDU 2082 找单词 (母函数模板)
找单词Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8070 Accepted Submission(s): 5652Problem Description假设有x1个字母A, x2个字母B,....原创 2017-08-15 10:38:39 · 218 阅读 · 0 评论 -
POJ 1426 Find The Multiple (数字太大,余数代替原数)
Find The MultipleDescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume th原创 2017-08-19 08:39:23 · 248 阅读 · 0 评论 -
POJ2891 Strange Way to Express Integers(解多元线性同余方程)(中国剩余定理非互质版)(例题)
Elina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following:Choose k different positive integers a1, a2, …, ak.原创 2017-08-03 20:30:34 · 290 阅读 · 0 评论 -
扩展欧几里德算法详解(通解推导过程)
扩展欧几里德算法 谁是欧几里德?自己百度去 先介绍什么叫做欧几里德算法 有两个数 a b,现在,我们要求 a b 的最大公约数,怎么求?枚举他们的因子?不现实,当 a b 很大的时候,枚举显得那么的naïve ,那怎么做? 欧几里德有个十分又用的定理: gcd(a, b) = gcd(b , a%b) ,这样,我们就可以在几乎是 log 的时原创 2017-08-01 10:56:09 · 3577 阅读 · 6 评论 -
poj 2769 Reduced ID Numbers (同余定理)
Reduced ID NumbersTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 10341 Accepted: 4114DescriptionT. Chur teaches various groups of students at universit原创 2017-08-02 08:34:40 · 221 阅读 · 0 评论 -
nefu 2 猜想 (哥德巴赫猜想)
猜想Problem:2Time Limit:3000msMemory Limit:65536KDescription哥德巴赫(Goldbach ]C.,1690.3.18~1764.11.20)是德国数学家;出生于格奥尼格斯别尔格(现名加里宁城);曾在英国牛津大学学习;原学法学,由于在欧洲各国访问期间结识了贝努利家族,所以对数学研究产生了兴趣;曾担任中学教师。1725年,到了俄国,同年被选为彼得堡转载 2017-08-01 17:09:11 · 349 阅读 · 0 评论 -
ACM数论之旅6---数论倒数,又称逆元(我整个人都倒了( ̄﹏ ̄))
数论倒数,又称逆元(因为我说习惯逆元了,下面我都说逆元)数论中的倒数是有特别的意义滴你以为a的倒数在数论中还是1/a吗(・∀・)哼哼~天真 先来引入求余概念 (a + b) % p = (a%p + b%p) %p (对)(a - b) % p = (a%p - b%p) %p (对)(a * b) % p = (a%p * b%p) %p转载 2017-09-19 19:40:19 · 584 阅读 · 0 评论