0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Python(3.4)で最大公約数を求めるコーディング

Last updated at Posted at 2019-10-01

先日のABC142のD問題で、最大公約数を求める必要があった。
愚直にロジックを考えていたのだが、ほかの回答者のソースコードを見たらなんと既存の関数があるではないか。
ということで備忘録。

from fractions import gcd
p = gcd(m,n)

これだけ。

※なお、gcd = Greatest Common Divisor(最大公約数)とのこと。

0
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?