結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,408 KB
testcase_01 AC 35 ms
52,776 KB
testcase_02 AC 34 ms
52,388 KB
testcase_03 AC 35 ms
52,768 KB
testcase_04 AC 35 ms
52,848 KB
testcase_05 WA -
testcase_06 AC 42 ms
59,956 KB
testcase_07 WA -
testcase_08 AC 39 ms
58,948 KB
testcase_09 AC 35 ms
52,912 KB
testcase_10 AC 39 ms
59,668 KB
testcase_11 AC 36 ms
53,596 KB
testcase_12 AC 38 ms
52,956 KB
testcase_13 AC 39 ms
58,096 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 42 ms
60,108 KB
testcase_17 AC 39 ms
59,540 KB
testcase_18 AC 41 ms
59,848 KB
testcase_19 AC 40 ms
58,908 KB
testcase_20 AC 44 ms
60,636 KB
testcase_21 AC 41 ms
59,112 KB
testcase_22 WA -
testcase_23 AC 40 ms
58,048 KB
testcase_24 WA -
testcase_25 AC 40 ms
58,972 KB
testcase_26 AC 36 ms
53,308 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 36 ms
52,720 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