結果
問題 |
No.1092 modular arithmetic
|
ユーザー |
![]() |
提出日時 | 2020-07-18 22:14:45 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 325 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 82,300 KB |
実行使用メモリ | 330,316 KB |
最終ジャッジ日時 | 2024-12-14 09:45:49 |
合計ジャッジ時間 | 7,467 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 WA * 11 TLE * 1 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() p,n=map(int,input().split()) A=[int(i) for i in input().split()] S=input() ans=A[0] for i in range(n-1): if S[i]=="+": ans=ans+A[i+1] if S[i]=="-": ans=ans-A[i+1] if S[i]=="*": ans=ans*A[i+1] if S[i]=="/": ans=(ans*pow(A[i+1],p-2,p))%p print(ans)