結果

問題 No.1819 Mirrored 2
ユーザー ああいいああいい
提出日時 2022-01-21 23:28:21
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 492 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 76,076 KB
最終ジャッジ日時 2023-08-17 08:13:53
合計ジャッジ時間 8,196 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
75,688 KB
testcase_01 AC 77 ms
75,588 KB
testcase_02 AC 79 ms
75,788 KB
testcase_03 AC 77 ms
75,660 KB
testcase_04 AC 77 ms
75,628 KB
testcase_05 AC 78 ms
75,628 KB
testcase_06 AC 79 ms
75,928 KB
testcase_07 AC 77 ms
75,544 KB
testcase_08 AC 77 ms
75,692 KB
testcase_09 AC 78 ms
75,728 KB
testcase_10 AC 78 ms
75,648 KB
testcase_11 WA -
testcase_12 AC 78 ms
75,432 KB
testcase_13 AC 80 ms
75,600 KB
testcase_14 AC 80 ms
75,652 KB
testcase_15 AC 78 ms
75,796 KB
testcase_16 AC 81 ms
75,696 KB
testcase_17 AC 82 ms
75,712 KB
testcase_18 AC 78 ms
75,860 KB
testcase_19 AC 77 ms
75,712 KB
testcase_20 AC 77 ms
75,780 KB
testcase_21 WA -
testcase_22 AC 79 ms
75,648 KB
testcase_23 AC 79 ms
75,648 KB
testcase_24 AC 79 ms
75,652 KB
testcase_25 AC 78 ms
75,748 KB
testcase_26 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

P,Q,x,y = input().split()

rQ = Q[::-1]
ry = y[::-1]
x = int(x)
P = int(P)
rry = int(ry)
inv = pow(rry,P-2,P)
rrQ = int(rQ)
u = inv * (x-rrQ) % P
s = len(Q) + 1
now = pow(10,s,P)
while now % P != u:
    s += 1
    now = now * 10 % P
ans = str(ry) + '0' * (s-len(Q)) + str(rQ)
if rry % P != 0:
    print(ans)
    exit()
inv = pow(rrQ,P-2,P)
u = inv * (x-1) % P
s = 1
now = 10
while now != u:
    s += 1
    now = now * 10 % P
ans = str(ry) + str(rQ) + '0' * (s-1) + '1'
print(ans)
0