結果

問題 No.265 数学のテスト
ユーザー nebukuro09
提出日時 2016-10-25 23:19:05
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 533 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-11-24 03:44:32
合計ジャッジ時間 1,836 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 RE * 15
権限があれば一括ダウンロードができます

ソースコード

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