結果

問題 No.1243 約数加算
ユーザー shotoyooshotoyoo
提出日時 2020-10-02 22:40:26
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 495 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,328 KB
実行使用メモリ 849,132 KB
最終ジャッジ日時 2024-07-17 22:22:38
合計ジャッジ時間 3,612 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 MLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


t = int(input())
ans = [None]*t
from math import gcd
def sub(a,b):
    if a==b:
        return []
    l = []
    g = gcd(a,b)
    l.append(g)
    l.extend([item*g for item in sub(a//g+1,b//g)])
    return l
        
for ind in range(t):
    a,b = list(map(int, input().split()))
    ans = sub(a,b)
    print(len(ans))
    write(" ".join(map(str, ans)))
0