結果

問題 No.265 数学のテスト
ユーザー roiti46
提出日時 2015-08-07 22:59:26
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 627 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-07-18 05:14:47
合計ジャッジ時間 1,334 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 RE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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