結果

問題 No.141 魔法少女コバ
ユーザー maspy
提出日時 2020-01-06 11:35:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 350 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-22 23:55:31
合計ジャッジ時間 5,259 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 93
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x,y = map(int,read().split())

answer = 0
while x != y:
    if x < y:
        x,y = y,x
        answer += 1
    q,r = divmod(x,y)
    if r:
        x,y = r,y
        answer += q
    else:
        x = y; answer += q - 1

print(answer)
0