摘要: a和b的最大公约数 d = gcd(a,b) = gcd(b, a mod b) 当(a mod b) =0时, b极为所求。 同时, d=a*x+b*y(x,y为整数); 代码如下: C代码#include<stdio.h>long gcd(long a, long b, int* x, int* y){ int t; long tmp; if(b==0) { *x=1; *y=0; ... 阅读全文
posted @ 2012-01-13 20:53 wouldguan 阅读(160) 评论(0) 推荐(0) 编辑