码迷,mamicode.com
首页 >  
搜索关键字:欧几里得    ( 1065个结果
数论大整理(不定时更新)(虽然是懵着听下来的)x
一、斐波那契数列: 1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 int main() 5 { 6 double a,n,ans; 7 cin>>n; 8 //n--; //(第一项是0时) 9 a=sqrt(5); ...
分类:其他好文   时间:2017-04-20 23:16:48    阅读次数:219
欧几里得?x
1、欧几里得算法 带余除法定理:a,b∈Z,其中b>0,存在唯一q及r,使a=bq+r,其中0<=r<b; 辗转相除法(欧几里得算法)依据:(a,b)=(b,r) C++实现: 2.扩展欧几里得算法(裴蜀定理) 其中a,b是任意两个不全为0的整数,则存在两个整数x,y,使得ax+by=(a,b); ...
分类:其他好文   时间:2017-04-20 23:13:05    阅读次数:188
数论--欧几里得定理(求最大公约数)
辗转相除法: 辗转相减法: ...
分类:其他好文   时间:2017-04-20 21:20:01    阅读次数:200
各种数论模板
1.筛法求素数 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 using namespace std; 6 const int MAXN=10001; 7 int vis[MAXN]; ...
分类:其他好文   时间:2017-04-20 19:28:42    阅读次数:143
UVA 10090 Marbles(扩展欧几里得)
Marbles Input: standard input Output: standard output I have some (say, n) marbles (small glass balls) and I am going to buy some boxes to store them. ...
分类:其他好文   时间:2017-04-18 14:25:45    阅读次数:158
c语言求两个数的最大公因数(穷举法,欧几里得算法,递归)
/*主函数Gcd为求公因数的函数输入为负时返回-1*/ int main(){ int a, b; printf("Input a,b:"); scanf("%d,%d",&a,&b); if (a < 0 || b < 0) printf("Input number should be posit ...
分类:编程语言   时间:2017-04-13 13:38:08    阅读次数:2559
POJ2115 C Looooops
1 /* 2 POJ2115 C Looooops 3 http://poj.org/problem?id=2115 4 扩展欧几里得 5 题意:求x, s.t. (a+c*x)=b (mod 1 c*x=b-a (mod 1 9 #include 10 #include 11 #include 1... ...
分类:其他好文   时间:2017-04-13 08:45:02    阅读次数:157
AC日记——青蛙的约会 poj 1061
青蛙的约会 POJ - 1061 青蛙的约会 POJ - 1061 青蛙的约会 思路: 扩展欧几里得; 设青蛙们要跳k步,我们可以得出式子 m*k+a≡n*k+b(mod l) 式子变形得到 m*k+a-n*k-b=t*l (m-n)*k-t*l=b-a 然后,exgcd函数求出k 然后输出刚刚大于 ...
分类:其他好文   时间:2017-04-12 04:31:22    阅读次数:175
【BZOJ 4148】 4148: [AMPPZ2014]Pillars (乱搞)
4148: [AMPPZ2014]Pillars Description 给定一个n*m的矩形,其中有f个2*2的障碍物,其中任意两个障碍物中心之间的欧几里得距离至少为6, 且每个障碍物的中心到边缘的距离至少为3。请找到一条从左下角(1,1)出发经过所有没有障碍物的点各 一次的且最后回到左下角的回路 ...
分类:其他好文   时间:2017-04-10 09:28:52    阅读次数:163
POJ1061-青蛙的约会---扩展欧几里德算法求最小整数解
扩展欧几里得算法模板 1.对于形如a*x0 + b*y0 = n的不定方程为了求解x0和y0,可以通过扩展欧几里得先求出满足a*x + b*y = gcd(a, b)的x和y。 2.容易得到,若(x-y)%gcd(a,b)==0,则该不定方程有整数解,否则无符合条件的整数解。 3.得到x和y后,可以 ...
分类:编程语言   时间:2017-04-08 12:56:56    阅读次数:270
1065条   上一页 1 ... 51 52 53 54 55 ... 107 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!