結果

問題 No.415 ぴょん
ユーザー LyricalMaestro
提出日時 2025-08-30 01:39:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 410 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2025-08-30 01:39:10
合計ジャッジ時間 1,908 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/415


def calc_gcd(A, B):
    """
    正の整数A, Bの最大公約数を計算する
    """
    a = max(A, B)
    b = min(A, B)
    while a % b > 0:
        c = a % b
        a = b
        b = c
    return b


def main():
    N, D = map(int, input().split())

    gcd = calc_gcd(N, D)
    ans = N // gcd
    print(ans - 1)










if __name__ == "__main__":
    main()
0