結果

問題 No.2125 Inverse Sum
ユーザー titiatitia
提出日時 2023-05-02 03:07:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-30 22:52:34
合計ジャッジ時間 3,197 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
10,880 KB
testcase_01 AC 46 ms
10,624 KB
testcase_02 AC 44 ms
10,752 KB
testcase_03 AC 44 ms
10,624 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 51 ms
10,624 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 52 ms
10,752 KB
testcase_10 AC 51 ms
10,752 KB
testcase_11 AC 44 ms
10,752 KB
testcase_12 AC 43 ms
10,624 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 48 ms
10,752 KB
testcase_18 AC 50 ms
10,752 KB
testcase_19 AC 49 ms
10,752 KB
testcase_20 WA -
testcase_21 AC 49 ms
10,752 KB
testcase_22 AC 49 ms
10,624 KB
testcase_23 AC 51 ms
10,624 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 43 ms
10,624 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 44 ms
10,624 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

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

ANS=[]
if P%Q==0 and P//Q==1:
    ANS.append((2,2))
if P%Q==0 and P//Q==2:
    ANS.append((1,1))

for x in LIST:
    if Q-x*P!=0 and x*Q%(Q-x*P)==0:
        y=-x*Q//(Q-x*P)

        if x>0 and y>0:
            ANS.append((x,y))

ANS=set(ANS)

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