結果

問題 No.1092 modular arithmetic
ユーザー KeroruKeroru
提出日時 2020-06-25 19:23:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,238 ms / 2,000 ms
コード長 237 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 116,236 KB
最終ジャッジ日時 2023-09-16 22:55:25
合計ジャッジ時間 23,613 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,324 KB
testcase_01 AC 1,238 ms
116,236 KB
testcase_02 AC 77 ms
71,128 KB
testcase_03 AC 1,204 ms
109,088 KB
testcase_04 AC 975 ms
101,172 KB
testcase_05 AC 982 ms
102,388 KB
testcase_06 AC 703 ms
95,100 KB
testcase_07 AC 985 ms
101,596 KB
testcase_08 AC 1,097 ms
105,076 KB
testcase_09 AC 958 ms
101,456 KB
testcase_10 AC 834 ms
97,576 KB
testcase_11 AC 949 ms
100,604 KB
testcase_12 AC 734 ms
94,896 KB
testcase_13 AC 897 ms
99,856 KB
testcase_14 AC 1,005 ms
104,780 KB
testcase_15 AC 270 ms
83,096 KB
testcase_16 AC 787 ms
97,120 KB
testcase_17 AC 1,067 ms
104,636 KB
testcase_18 AC 1,164 ms
106,860 KB
testcase_19 AC 742 ms
96,220 KB
testcase_20 AC 1,199 ms
107,360 KB
testcase_21 AC 928 ms
99,976 KB
testcase_22 AC 1,108 ms
105,380 KB
testcase_23 AC 154 ms
89,196 KB
testcase_24 AC 102 ms
78,364 KB
testcase_25 AC 133 ms
85,612 KB
testcase_26 AC 143 ms
89,108 KB
testcase_27 AC 92 ms
76,344 KB
testcase_28 AC 131 ms
85,532 KB
testcase_29 AC 166 ms
92,960 KB
testcase_30 AC 134 ms
85,628 KB
testcase_31 AC 89 ms
76,600 KB
testcase_32 AC 130 ms
84,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p,n=map(int,input().split())
a=list(map(int,input().split()))[::-1]
t=a.pop()
op=list(input())[::-1]
while op:
    x=op.pop()
    if x=='/':
        t*=pow(a.pop(),p-2,p)
    else:
        t=eval(str(t)+x+str(a.pop()))
    t%=p

print(t)
0