結果
問題 | No.2125 Inverse Sum |
ユーザー |
![]() |
提出日時 | 2023-05-02 03:17:33 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,242 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 159,896 KB |
最終ジャッジ日時 | 2024-11-20 21:24:15 |
合計ジャッジ時間 | 8,899 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
import sys input = sys.stdin.readline P,Q=map(int,input().split()) LIST=[] for i in range(1,2*10**5): if Q%i==0: LIST.append(i) LIST.append(Q//i) LIST2=[] for l in LIST: for m in LIST: LIST2.append(l*m) LIST2=set(LIST2) ANS=[] for x in LIST2: y=Q*Q//x if (x+Q)%P==0 and (y+Q)%P==0 and (x+Q)//P>0 and (y+Q)//P>0: ANS.append(((x+Q)//P,(y+Q)//P)) ANS=sorted(set(ANS)) print(len(ANS)) for x,y in ANS: print(x,y)