結果
問題 |
No.1092 modular arithmetic
|
ユーザー |
![]() |
提出日時 | 2020-07-18 22:11:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 329 bytes |
コンパイル時間 | 99 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,728 KB |
最終ジャッジ日時 | 2024-12-14 09:37:29 |
合計ジャッジ時間 | 7,655 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 23 WA * 9 |
ソースコード
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])%p if S[i]=="/": ans=(ans*pow(A[i+1],p-2,p))%p print(ans)