結果
問題 | No.1243 約数加算 |
ユーザー |
|
提出日時 | 2020-10-14 02:20:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 673 bytes |
コンパイル時間 | 107 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-07-20 18:55:08 |
合計ジャッジ時間 | 1,544 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#!/usr/bin/env python3import mathfrom typing import *def solve(a: int, b: int) -> List[int]:if a == b:return []c = []e = []if a % 2 == 1:a += 1c.append(1)if b % 2 == 1:b -= 1e.append(1)d = math.gcd(a, b)a //= db //= dreturn c + [d * x for x in solve(a, b)] + e# generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)def main():t = int(input())for i in range(t):a, b = map(int, input().split())c = solve(a, b)print(len(c))print(*c)if __name__ == '__main__':main()