結果

問題 No.1092 modular arithmetic
ユーザー pluto77pluto77
提出日時 2020-06-25 08:58:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 19,184 KB
最終ジャッジ日時 2023-09-16 21:42:23
合計ジャッジ時間 6,063 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,860 KB
testcase_01 AC 94 ms
19,184 KB
testcase_02 AC 13 ms
7,872 KB
testcase_03 AC 150 ms
18,188 KB
testcase_04 AC 129 ms
16,596 KB
testcase_05 AC 137 ms
16,484 KB
testcase_06 AC 101 ms
13,964 KB
testcase_07 AC 122 ms
16,580 KB
testcase_08 AC 138 ms
17,496 KB
testcase_09 AC 123 ms
16,316 KB
testcase_10 AC 106 ms
14,768 KB
testcase_11 AC 120 ms
15,824 KB
testcase_12 AC 97 ms
13,880 KB
testcase_13 AC 55 ms
9,216 KB
testcase_14 AC 63 ms
9,588 KB
testcase_15 AC 25 ms
8,420 KB
testcase_16 AC 51 ms
9,016 KB
testcase_17 AC 68 ms
9,676 KB
testcase_18 AC 154 ms
18,024 KB
testcase_19 AC 98 ms
13,840 KB
testcase_20 AC 160 ms
18,216 KB
testcase_21 AC 122 ms
15,876 KB
testcase_22 AC 145 ms
17,728 KB
testcase_23 AC 282 ms
15,764 KB
testcase_24 AC 92 ms
10,452 KB
testcase_25 AC 235 ms
13,908 KB
testcase_26 AC 271 ms
16,036 KB
testcase_27 AC 54 ms
9,236 KB
testcase_28 AC 227 ms
13,824 KB
testcase_29 AC 337 ms
17,404 KB
testcase_30 AC 233 ms
14,084 KB
testcase_31 AC 40 ms
9,040 KB
testcase_32 AC 209 ms
13,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1092
p,n=map(int,input().split())
a=list(map(int,input().split()))
s=input()
res=a[0]
for i in range(n-1):
 if s[i]=='+':
  res+=a[i+1]
 elif s[i]=='-':
  res-=a[i+1]
 elif s[i]=='*':
  res*=a[i+1]
 else:
  res*=pow(a[i+1],p-2,p)
 res%=p
print(res)
0