結果
| 問題 |
No.3022 一元一次式 mod 1000000000
|
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2025-02-14 22:20:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 238 bytes |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 82,548 KB |
| 実行使用メモリ | 77,988 KB |
| 最終ジャッジ日時 | 2025-02-14 22:20:48 |
| 合計ジャッジ時間 | 2,831 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 9 |
ソースコード
import math
T=int(input())
for _ in range(T):
N,M=map(int, input().split())
p=10**9
try:
g = math.gcd(p-M, N)
N%=p
M%=p
t=(p-M)//g*pow(N//g,-1,p)%p
print(t)
except:
print(-1)
nikoro256