結果

問題 No.1092 modular arithmetic
ユーザー Keroru
提出日時 2020-06-25 19:21:45
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 222 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 843,932 KB
最終ジャッジ日時 2024-07-03 21:42:13
合計ジャッジ時間 6,233 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 MLE * 2 -- * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

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

print(t)
0