結果

問題 No.2125 Inverse Sum
ユーザー titiatitia
提出日時 2023-05-02 03:17:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,122 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 159,984 KB
最終ジャッジ日時 2024-04-30 22:56:37
合計ジャッジ時間 7,604 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
10,624 KB
testcase_01 AC 50 ms
10,752 KB
testcase_02 AC 48 ms
10,624 KB
testcase_03 AC 49 ms
10,752 KB
testcase_04 AC 50 ms
10,624 KB
testcase_05 AC 58 ms
11,392 KB
testcase_06 AC 55 ms
11,264 KB
testcase_07 AC 53 ms
10,624 KB
testcase_08 AC 53 ms
10,752 KB
testcase_09 AC 56 ms
11,392 KB
testcase_10 AC 57 ms
11,264 KB
testcase_11 AC 50 ms
10,752 KB
testcase_12 AC 48 ms
10,752 KB
testcase_13 AC 54 ms
10,752 KB
testcase_14 AC 123 ms
25,216 KB
testcase_15 AC 56 ms
11,264 KB
testcase_16 AC 64 ms
12,672 KB
testcase_17 AC 51 ms
10,624 KB
testcase_18 AC 54 ms
11,264 KB
testcase_19 AC 54 ms
10,624 KB
testcase_20 AC 78 ms
15,744 KB
testcase_21 AC 52 ms
10,880 KB
testcase_22 AC 57 ms
11,264 KB
testcase_23 AC 54 ms
10,880 KB
testcase_24 AC 52 ms
10,752 KB
testcase_25 AC 55 ms
10,624 KB
testcase_26 AC 51 ms
10,624 KB
testcase_27 AC 1,122 ms
153,620 KB
testcase_28 AC 1,084 ms
159,876 KB
testcase_29 AC 651 ms
94,464 KB
testcase_30 AC 51 ms
10,752 KB
testcase_31 AC 1,092 ms
159,928 KB
testcase_32 AC 939 ms
159,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

P,Q=map(int,input().split())

LIST=[]
for i in range(1,2*10**5):
    if Q%i==0:
        LIST.append(i)
        LIST.append(Q//i)

LIST2=[]
for l in LIST:
    for m in LIST:
        LIST2.append(l*m)

LIST2=set(LIST2)
ANS=[]
for x in LIST2:
    y=Q*Q//x

    if (x+Q)%P==0 and (y+Q)%P==0 and (x+Q)//P>0 and (y+Q)//P>0:
        ANS.append(((x+Q)//P,(y+Q)//P))
        
ANS=sorted(set(ANS))

print(len(ANS))
for x,y in ANS:
    print(x,y)
0