結果

問題 No.1794 Continued Fraction
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2024-03-10 18:33:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 61,432 KB
最終ジャッジ日時 2024-03-10 18:33:16
合計ジャッジ時間 3,517 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
61,432 KB
testcase_01 AC 51 ms
61,432 KB
testcase_02 AC 50 ms
61,432 KB
testcase_03 AC 52 ms
61,432 KB
testcase_04 AC 49 ms
61,432 KB
testcase_05 AC 47 ms
61,432 KB
testcase_06 AC 47 ms
61,432 KB
testcase_07 AC 47 ms
61,432 KB
testcase_08 AC 49 ms
61,432 KB
testcase_09 AC 56 ms
61,432 KB
testcase_10 AC 48 ms
61,432 KB
testcase_11 AC 48 ms
61,432 KB
testcase_12 AC 47 ms
61,432 KB
testcase_13 AC 49 ms
61,432 KB
testcase_14 AC 52 ms
61,432 KB
testcase_15 AC 47 ms
61,432 KB
testcase_16 AC 46 ms
61,432 KB
testcase_17 AC 51 ms
61,432 KB
testcase_18 AC 52 ms
61,432 KB
testcase_19 AC 52 ms
61,432 KB
testcase_20 AC 51 ms
61,432 KB
testcase_21 AC 52 ms
61,432 KB
testcase_22 AC 50 ms
61,432 KB
testcase_23 AC 51 ms
61,432 KB
testcase_24 AC 63 ms
61,432 KB
testcase_25 AC 51 ms
61,432 KB
testcase_26 AC 52 ms
61,432 KB
testcase_27 AC 52 ms
61,432 KB
testcase_28 AC 53 ms
61,432 KB
testcase_29 AC 53 ms
61,432 KB
testcase_30 AC 51 ms
61,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit
# pypyjit.set_param("max_unroll_recursion=-1")
from collections import *
from functools import *
from itertools import *
from heapq import *
import sys, math,random,time
# input = sys.stdin.readline



N,M = map(int,input().split())
g = math.gcd(N,M)
N//=g
M//=g
if N==M:
    print(1)
    exit()
A = []
while N!=M:
    p,q = divmod(N,M)
    A.append(p)
    N,M = M,q
    if M==0:
        break
print(*A)
0