結果

問題 No.1794 Continued Fraction
ユーザー SPD_9X2
提出日時 2021-12-23 18:15:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 53,832 KB
最終ジャッジ日時 2024-09-17 16:36:32
合計ジャッジ時間 2,232 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""

import sys
from sys import stdin

N,M = map(int,stdin.readline().split())

ans = []

while True:

    if N == 1 or M == 0:
        ans.append(0)
        ans.append(M)
        break

    else:

        p = N // M
        ans.append(p)
        N,M = M , N % M

    #print (N,M)

while len(ans) > 0 and ans[-1] == 0:
    del ans[-1]
print (*ans)
0