結果

問題 No.1092 modular arithmetic
ユーザー first_vilfirst_vil
提出日時 2020-06-25 10:19:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 10,512 KB
実行使用メモリ 19,160 KB
最終ジャッジ日時 2023-09-16 21:49:33
合計ジャッジ時間 6,084 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 84 ms
19,160 KB
testcase_02 AC 16 ms
7,796 KB
testcase_03 AC 157 ms
18,268 KB
testcase_04 AC 133 ms
16,460 KB
testcase_05 AC 136 ms
16,556 KB
testcase_06 AC 103 ms
13,900 KB
testcase_07 AC 126 ms
16,452 KB
testcase_08 AC 144 ms
17,340 KB
testcase_09 AC 129 ms
16,228 KB
testcase_10 AC 113 ms
14,720 KB
testcase_11 AC 124 ms
15,780 KB
testcase_12 AC 106 ms
13,840 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 25 ms
8,404 KB
testcase_16 AC 47 ms
9,084 KB
testcase_17 WA -
testcase_18 AC 164 ms
18,012 KB
testcase_19 AC 104 ms
13,888 KB
testcase_20 AC 165 ms
18,356 KB
testcase_21 AC 130 ms
15,836 KB
testcase_22 AC 158 ms
17,648 KB
testcase_23 AC 310 ms
15,616 KB
testcase_24 AC 102 ms
10,444 KB
testcase_25 AC 237 ms
13,784 KB
testcase_26 AC 279 ms
15,916 KB
testcase_27 AC 56 ms
9,380 KB
testcase_28 AC 233 ms
13,876 KB
testcase_29 AC 360 ms
17,392 KB
testcase_30 AC 237 ms
14,192 KB
testcase_31 AC 44 ms
8,944 KB
testcase_32 AC 221 ms
13,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p,n=map(int,input().split())
a=list(map(int,input().split()))
ans=a[0]
s=input()
for x,c in zip(a[1:],s):
    if c=='+':
        ans+=x
    elif c=='-':
        ans+=p-x
    elif c=='*':
        ans*=x
    else:
        ans*=pow(x,p-2,p)
    if p<ans:
        ans%=p
print(ans)
0