結果
問題 |
No.3022 一元一次式 mod 1000000000
|
ユーザー |
![]() |
提出日時 | 2025-02-16 01:10:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 525 bytes |
コンパイル時間 | 808 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2025-02-16 01:10:14 |
合計ジャッジ時間 | 3,450 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 1 |
ソースコード
import sys input = sys.stdin.readline def p(x,m): ANS=0 while x%m==0: ANS+=1 x//=m return ANS T=int(input()) for tests in range(T): N,M=map(int,input().split()) N2=p(N,2) N5=p(N,5) M2=p(M,2) M5=p(M,5) if min(N2,9)<=M2 and min(N5,9)<=M5: pass else: print(-1) continue d=(2**min(N2,9))*(5**min(N5,9)) N//=d M//=d mod=10**9 mod//=d k=-M*pow(N,-1,mod)%mod if mod==1: print(1) else: print(k)