結果

問題 No.265 数学のテスト
ユーザー roiti46roiti46
提出日時 2015-08-07 23:00:53
言語 Python2
(2.7.18)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 661 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 6,652 KB
実行使用メモリ 10,276 KB
最終ジャッジ日時 2023-09-25 06:12:57
合計ジャッジ時間 3,705 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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
            if cnt - dx >= 0:
                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