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