結果

問題 No.1092 modular arithmetic
ユーザー Keroru
提出日時 2020-06-25 19:23:10
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 784 ms / 2,000 ms
+ 930µs
コード長 237 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,188 ms
コンパイル使用メモリ 95,984 KB
実行使用メモリ 133,168 KB
最終ジャッジ日時 2026-08-05 12:09:17
合計ジャッジ時間 17,459 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

p,n=map(int,input().split())
a=list(map(int,input().split()))[::-1]
t=a.pop()
op=list(input())[::-1]
while op:
    x=op.pop()
    if x=='/':
        t*=pow(a.pop(),p-2,p)
    else:
        t=eval(str(t)+x+str(a.pop()))
    t%=p

print(t)
0