結果

問題 No.1092 modular arithmetic
ユーザー sasa8uyauya
提出日時 2025-03-08 09:38:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 221 bytes
コンパイル時間 491 ms
コンパイル使用メモリ 82,964 KB
実行使用メモリ 95,616 KB
最終ジャッジ日時 2025-03-08 09:38:18
合計ジャッジ時間 6,109 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

M,n=map(int,input().split())
a=list(map(int,input().split()))
x=a[0]
for c,y in zip(list(input()),a[1:]):
	if c=="+":
		x=(x+y)%M
	if c=="-":
		x=(x-y)%M
	if c=="*":
		x=(x*y)%M
	if c=="/":
		x=(x*pow(y,M-2,M))%M
print(x)
0