摘要: Calculating LCM is based on calculating GCD:Get LCM by Euclid algorithm :int LCM_Euclid(int &n,int &m){if(n==0||m==0) return 0;int a=n,b=m,k;while(a%b!=0){a%=b;swap(a,b);}return n*m/b;}View Code 阅读全文
posted @ 2013-10-06 14:47 光辉灿烂的日子 阅读(86) 评论(0) 推荐(0) 编辑