結果

問題 No.2125 Inverse Sum
ユーザー rlangevinrlangevin
提出日時 2023-01-28 15:36:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 88,216 KB
最終ジャッジ日時 2023-09-11 04:33:36
合計ジャッジ時間 6,751 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,120 KB
testcase_01 AC 78 ms
71,380 KB
testcase_02 AC 77 ms
71,228 KB
testcase_03 AC 77 ms
71,300 KB
testcase_04 AC 79 ms
71,360 KB
testcase_05 WA -
testcase_06 AC 81 ms
75,784 KB
testcase_07 AC 80 ms
75,256 KB
testcase_08 AC 81 ms
75,456 KB
testcase_09 AC 81 ms
75,872 KB
testcase_10 AC 83 ms
75,860 KB
testcase_11 AC 76 ms
71,172 KB
testcase_12 AC 77 ms
71,176 KB
testcase_13 AC 79 ms
75,376 KB
testcase_14 AC 90 ms
76,208 KB
testcase_15 AC 83 ms
75,988 KB
testcase_16 AC 84 ms
76,052 KB
testcase_17 AC 81 ms
75,208 KB
testcase_18 AC 81 ms
75,876 KB
testcase_19 AC 80 ms
75,180 KB
testcase_20 AC 87 ms
76,336 KB
testcase_21 AC 82 ms
75,868 KB
testcase_22 AC 83 ms
75,904 KB
testcase_23 AC 82 ms
75,916 KB
testcase_24 AC 81 ms
75,188 KB
testcase_25 AC 81 ms
75,464 KB
testcase_26 AC 79 ms
71,336 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 77 ms
71,024 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def div(n):
    S = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.add(i)
            S.add(n // i)
        i += 1
    S.add(1)
    return list(S)

P, Q = map(int, input().split())
S = set()
L = div(Q)
for a in L:
    for b in L:
        S.add(a * b)
    
ans = []
Q2 = Q * Q
for d1 in S:
    d2 = Q2 // d1
    if (d1 + Q) % P or (d2 + Q) % P:
        continue
    ans.append(((d1 + Q)//P, (d2 + Q)//P))

print(len(ans))
for a, b in ans:
    print(a, b)
0