結果

問題 No.1794 Continued Fraction
ユーザー lloyzlloyz
提出日時 2021-12-23 00:44:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 235 bytes
コンパイル時間 675 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 8,188 KB
最終ジャッジ日時 2023-10-15 03:25:01
合計ジャッジ時間 4,535 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,780 KB
testcase_01 AC 16 ms
8,092 KB
testcase_02 AC 16 ms
7,944 KB
testcase_03 AC 15 ms
7,960 KB
testcase_04 AC 16 ms
7,756 KB
testcase_05 AC 16 ms
7,956 KB
testcase_06 AC 15 ms
8,180 KB
testcase_07 RE -
testcase_08 AC 15 ms
7,884 KB
testcase_09 AC 16 ms
7,944 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 16 ms
7,816 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 16 ms
7,844 KB
testcase_17 AC 15 ms
7,972 KB
testcase_18 RE -
testcase_19 AC 16 ms
7,896 KB
testcase_20 AC 16 ms
7,932 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 15 ms
7,860 KB
testcase_24 RE -
testcase_25 AC 16 ms
7,764 KB
testcase_26 AC 15 ms
7,832 KB
testcase_27 RE -
testcase_28 AC 16 ms
8,188 KB
testcase_29 AC 15 ms
7,764 KB
testcase_30 AC 15 ms
7,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())

if m == 1:
    print(n)
    exit()

ANS = []
q, r = divmod(n, m)
ANS.append(q)
n = r
while n != 1:
    q, r = divmod(m, n)
    ANS.append(q)
    n, m = r, n
ANS.append(m)
print(*ANS)

0