結果
問題 | No.3022 一元一次式 mod 1000000000 |
ユーザー |
![]() |
提出日時 | 2025-02-15 02:42:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 449 ms / 2,000 ms |
コード長 | 450 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 82,004 KB |
実行使用メモリ | 77,464 KB |
最終ジャッジ日時 | 2025-02-17 12:58:24 |
合計ジャッジ時間 | 2,632 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
import mathT=int(input())for _ in range(T):N,M=map(int, input().split())p=10**9g = math.gcd(N,M,10**9)N%=pM%=pif N==0 and M==0:print(1)continueelif N==0:print(-1)continueN//=gM//=gt=10**9//gif N%t==0 or math.gcd(N,t)>1:print(-1)else:a = -M*pow(N,-1,t)%tif a==0:print(10**9)continueprint(a)