結果
問題 | No.2125 Inverse Sum |
ユーザー |
![]() |
提出日時 | 2023-05-02 03:08:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 469 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-20 21:19:34 |
合計ジャッジ時間 | 2,869 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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,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)