結果
| 問題 | 
                            No.2125 Inverse Sum
                             | 
                    
| コンテスト | |
| ユーザー | 
                             titia
                         | 
                    
| 提出日時 | 2023-05-02 03:07:24 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 461 bytes | 
| コンパイル時間 | 232 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-11-20 21:19:06 | 
| 合計ジャッジ時間 | 3,475 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 14 WA * 16 | 
ソースコード
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)
            
            
            
        
            
titia