結果
| 問題 |
No.1819 Mirrored 2
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-01-22 00:13:01 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 711 bytes |
| コンパイル時間 | 92 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-11-26 07:25:13 |
| 合計ジャッジ時間 | 1,986 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 26 |
ソースコード
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
if N%10==0:
continue
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)<100000:
print(XX)
break
titia