結果

問題 No.265 数学のテスト
ユーザー nebukuro09nebukuro09
提出日時 2016-10-25 23:19:05
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 533 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-05-03 06:04:44
合計ジャッジ時間 1,959 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 19 ms
6,400 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 27 ms
6,528 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 27 ms
6,784 KB
testcase_09 RE -
testcase_10 AC 22 ms
6,656 KB
testcase_11 RE -
testcase_12 AC 12 ms
6,400 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 12 ms
6,272 KB
testcase_16 AC 14 ms
6,400 KB
testcase_17 AC 12 ms
6,400 KB
testcase_18 AC 12 ms
6,400 KB
testcase_19 AC 12 ms
6,272 KB
testcase_20 RE -
testcase_21 AC 12 ms
6,272 KB
testcase_22 RE -
testcase_23 AC 11 ms
6,400 KB
testcase_24 AC 12 ms
6,272 KB
testcase_25 RE -
testcase_26 AC 12 ms
6,272 KB
testcase_27 AC 12 ms
6,400 KB
testcase_28 RE -
testcase_29 AC 11 ms
6,272 KB
testcase_30 RE -
testcase_31 AC 12 ms
6,400 KB
testcase_32 AC 11 ms
6,400 KB
testcase_33 AC 12 ms
6,400 KB
testcase_34 AC 12 ms
6,400 KB
testcase_35 AC 12 ms
6,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
d = input()
S = filter(None, raw_input().replace('+', ' ').replace('d{', ' { ').replace('}', ' } ').split())
coef = [0 for i in xrange(d+1)]
dx = 0

for s in S:
    if s == '{':
        dx += 1
    elif s == '}':
        dx -= 1
    else:
        t = sorted(s.split('*'))
        if t[0].isdigit():
            c = int(t[0])
            t.pop(0)
        else:
            c = 1
        for i in xrange(len(t), len(t)-dx, -1):
            c *= i
        e = len(t) - dx
        coef[e] += c
print ' '.join(map(str, coef))
0