結果
問題 |
No.1819 Mirrored 2
|
ユーザー |
![]() |
提出日時 | 2022-01-22 00:10:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 676 bytes |
コンパイル時間 | 115 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-11-26 07:20:37 |
合計ジャッジ時間 | 2,936 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 WA * 6 |
ソースコード
import sys input = sys.stdin.readline P,Q,x,y=map(int,input().split()) # N mod P = x for tests in range(10**5): N=y+tests*Q REV=int(str(N)[::-1]) kk=pow(REV,P-2,P)*x%P # 10**y == kk # modが素数の場合 import math a = 10 b = kk mod = P SQ = int(math.sqrt(mod))+1 Powdict = {pow(a,i,mod):i for i in range(SQ)} # Baby-Step A = pow(pow(a,mod-2,mod),SQ,mod) for i in range(SQ): # Giant-Step if b*pow(A,i,mod)%mod in Powdict: ANS = i*SQ+Powdict[b*pow(A,i,mod)%mod] break else: continue XX=str(REV)+"0"*ANS if len(XX)<10000: print(XX) break