Algorithm
文章平均质量分 78
Jakkui
这个作者很懒,什么都没留下…
展开
-
Increasing Speed Limits
Google Cod Jam Round1C C题 Increasing Speed LimitsTime Remaining: You may resubmit this multiple times within the remainingtime-frame. Only your last submission will count. Pro转载 2008-10-05 12:47:00 · 388 阅读 · 0 评论 -
计算最大公约数的两种算法
欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。其计算原理依赖于下面的定理: 定理:gcd(a,b) = gcd(b,a mod b)其算法用C++语言描述为:int gcd(int m, int n){ if (m == 0) return n; if (n == 0) return m; if (m { int tmp = m; m = n; n = tmp;转载 2008-10-12 12:02:00 · 602 阅读 · 1 评论