結果

問題 No.2125 Inverse Sum
ユーザー gr1msl3ygr1msl3y
提出日時 2022-11-25 23:59:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 62,108 KB
最終ジャッジ日時 2024-04-10 04:54:06
合計ジャッジ時間 2,661 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,536 KB
testcase_01 AC 40 ms
52,832 KB
testcase_02 AC 35 ms
53,328 KB
testcase_03 AC 35 ms
53,000 KB
testcase_04 AC 36 ms
52,904 KB
testcase_05 WA -
testcase_06 AC 40 ms
58,948 KB
testcase_07 WA -
testcase_08 AC 38 ms
58,732 KB
testcase_09 AC 34 ms
53,152 KB
testcase_10 AC 39 ms
59,876 KB
testcase_11 AC 35 ms
53,988 KB
testcase_12 AC 35 ms
54,320 KB
testcase_13 AC 39 ms
59,016 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 39 ms
59,188 KB
testcase_17 AC 38 ms
58,672 KB
testcase_18 AC 40 ms
58,908 KB
testcase_19 AC 39 ms
59,764 KB
testcase_20 AC 41 ms
59,664 KB
testcase_21 AC 38 ms
59,060 KB
testcase_22 WA -
testcase_23 AC 38 ms
59,180 KB
testcase_24 WA -
testcase_25 AC 38 ms
59,524 KB
testcase_26 AC 35 ms
52,948 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 37 ms
53,180 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
P, Q = map(int, input().split())
g = gcd(P, Q)
P //= g
Q //= g
if P == Q == 1:
    print(1)
    print(2, 2)
    exit()
S = set()
for i in range(1, int(Q**0.5)+1):
    if Q % i == 0:
        S.add(i)
        S.add(Q//i)
S = sorted(set(S))

ans = []
for s in S:
    for t in S:
        if Q//s+Q//t == P:
            ans.append([s, t])

print(len(ans))
for a in ans:
    print(*a)
0