結果

問題 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,038 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 157,440 KB
最終ジャッジ日時 2023-08-13 04:48:28
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
7,820 KB
testcase_01 AC 37 ms
7,776 KB
testcase_02 AC 35 ms
7,756 KB
testcase_03 AC 36 ms
7,920 KB
testcase_04 AC 37 ms
7,752 KB
testcase_05 AC 44 ms
8,836 KB
testcase_06 AC 45 ms
8,824 KB
testcase_07 AC 40 ms
7,920 KB
testcase_08 AC 39 ms
7,880 KB
testcase_09 AC 43 ms
8,724 KB
testcase_10 AC 44 ms
8,716 KB
testcase_11 AC 37 ms
7,948 KB
testcase_12 AC 37 ms
7,808 KB
testcase_13 AC 40 ms
7,960 KB
testcase_14 AC 110 ms
22,748 KB
testcase_15 AC 43 ms
8,604 KB
testcase_16 AC 47 ms
10,120 KB
testcase_17 AC 41 ms
7,804 KB
testcase_18 AC 42 ms
8,672 KB
testcase_19 AC 39 ms
7,820 KB
testcase_20 AC 64 ms
13,168 KB
testcase_21 AC 41 ms
8,220 KB
testcase_22 AC 43 ms
8,768 KB
testcase_23 AC 41 ms
8,344 KB
testcase_24 AC 39 ms
7,776 KB
testcase_25 AC 40 ms
7,788 KB
testcase_26 AC 37 ms
7,808 KB
testcase_27 AC 1,037 ms
150,672 KB
testcase_28 AC 1,001 ms
157,440 KB
testcase_29 AC 586 ms
91,696 KB
testcase_30 AC 38 ms
7,808 KB
testcase_31 AC 1,038 ms
157,404 KB
testcase_32 AC 887 ms
157,420 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