2009/02/17
関数の実装(最大公約数)
B.B.S. を使うための関数を書いていきます。
まずは、最大公約数。これはユークリッドの互助法でいいでしょう。
def gcd(a, b): if b == 0: return a else: return gcd(b, a%b)
これだけで完成です。
- Category(s)
- j@ウェブ屋
- The URL to Trackback this entry is:
- http://www.xscale-freak.com/Members/folder/staff/95a26570306e5b9f88c5-67005c0f516c500d6570/tbping