結果

問題 No.2125 Inverse Sum
ユーザー titiatitia
提出日時 2023-05-02 03:08:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,000 KB
最終ジャッジ日時 2023-08-13 04:43:19
合計ジャッジ時間 2,443 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
7,832 KB
testcase_01 AC 29 ms
7,812 KB
testcase_02 AC 28 ms
7,836 KB
testcase_03 AC 28 ms
7,792 KB
testcase_04 AC 27 ms
7,816 KB
testcase_05 WA -
testcase_06 AC 33 ms
7,808 KB
testcase_07 WA -
testcase_08 AC 33 ms
7,924 KB
testcase_09 AC 32 ms
7,812 KB
testcase_10 AC 33 ms
7,948 KB
testcase_11 AC 28 ms
7,804 KB
testcase_12 AC 27 ms
7,812 KB
testcase_13 AC 30 ms
7,808 KB
testcase_14 AC 31 ms
7,864 KB
testcase_15 AC 30 ms
7,728 KB
testcase_16 AC 31 ms
7,876 KB
testcase_17 AC 30 ms
7,916 KB
testcase_18 AC 30 ms
7,728 KB
testcase_19 AC 30 ms
7,976 KB
testcase_20 AC 30 ms
7,880 KB
testcase_21 AC 30 ms
7,828 KB
testcase_22 AC 31 ms
7,884 KB
testcase_23 AC 32 ms
7,812 KB
testcase_24 WA -
testcase_25 AC 33 ms
7,812 KB
testcase_26 AC 28 ms
7,816 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 28 ms
7,884 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=sorted(set(ANS))

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