会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
洛书
博客园
首页
新随笔
联系
订阅
管理
素质系列(一)数学魅力(1):欧几里德法求最大公约数
核心代码:
Code
private
int
GreatestCommonDivisor(
int
m,
int
n)
{
if
(n
>
m)
return
GreatestCommonDivisor(n, m);
int
temp
=
m
%
n;
if
(temp
==
0
)
return
n;
else
{
return
GreatestCommonDivisor(n, temp);
}
}
核心思想:自然数m和n的公约数必然为m/n的余数的公约数.
posted @
2008-08-10 18:36
~洛书~
阅读(
204
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
公告