結果

問題 No.265 数学のテスト
コンテスト
ユーザー roiti46
提出日時 2015-08-07 22:59:26
言語 PyPy2
(7.3.20)
結果
RE  
実行時間 -
コード長 627 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 230 ms
コンパイル使用メモリ 77,684 KB
最終ジャッジ日時 2025-12-03 16:08:52
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 RE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(raw_input())
d = int(raw_input())
S = raw_input()
ans = [0] * (d + 1)
dx = 0
tmp = 1
cnt = 0
exp = False
for c in S:
    if c == "{":
        dx += 1
    elif c == "x":
        exp = True
        cnt += 1
    elif c in "123456789":
        exp = True
        tmp = int(c)
    elif c != "*":
        if exp:
            for i in xrange(dx):
                tmp *= cnt - i
            ans[cnt - dx] += tmp
            exp = False
            cnt = 0
            tmp = 1
        if c == "}":
            dx -= 1
if exp:
    for i in xrange(dx):
        tmp *= cnt - i
    ans[cnt - dx] += tmp
print " ".join(map(str, ans))
0