結果
| 問題 |
No.1794 Continued Fraction
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-10 18:33:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 420 bytes |
| コンパイル時間 | 357 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 61,952 KB |
| 最終ジャッジ日時 | 2024-09-29 21:44:47 |
| 合計ジャッジ時間 | 3,235 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
# 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)