結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
10,752 KB
testcase_01 AC 70 ms
10,752 KB
testcase_02 AC 69 ms
10,752 KB
testcase_03 AC 68 ms
10,752 KB
testcase_04 AC 72 ms
10,752 KB
testcase_05 WA -
testcase_06 AC 83 ms
10,752 KB
testcase_07 WA -
testcase_08 AC 91 ms
10,880 KB
testcase_09 AC 94 ms
10,752 KB
testcase_10 AC 92 ms
10,752 KB
testcase_11 AC 72 ms
10,624 KB
testcase_12 AC 67 ms
10,624 KB
testcase_13 AC 86 ms
10,752 KB
testcase_14 AC 87 ms
10,880 KB
testcase_15 AC 86 ms
10,752 KB
testcase_16 AC 88 ms
10,752 KB
testcase_17 AC 87 ms
10,752 KB
testcase_18 AC 92 ms
10,752 KB
testcase_19 AC 90 ms
10,624 KB
testcase_20 AC 84 ms
10,624 KB
testcase_21 AC 86 ms
10,624 KB
testcase_22 AC 83 ms
10,752 KB
testcase_23 AC 86 ms
10,752 KB
testcase_24 WA -
testcase_25 AC 98 ms
10,752 KB
testcase_26 AC 80 ms
10,752 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 71 ms
10,752 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,2*10**5):
    if Q*2%i==0:
        LIST.append(i)
        LIST.append(Q*2//i)

    if P*2%i==0:
        LIST.append(i)
        LIST.append(P*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=sorted(set(ANS))

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