結果

問題 No.265 数学のテスト
ユーザー roiti46roiti46
提出日時 2015-08-07 22:59:26
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 627 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 6,732 KB
実行使用メモリ 6,128 KB
最終ジャッジ日時 2023-09-25 06:12:23
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 25 ms
6,036 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 26 ms
5,960 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 28 ms
6,080 KB
testcase_09 RE -
testcase_10 AC 23 ms
6,060 KB
testcase_11 RE -
testcase_12 AC 12 ms
5,860 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 11 ms
5,948 KB
testcase_16 AC 13 ms
5,940 KB
testcase_17 AC 11 ms
5,952 KB
testcase_18 AC 11 ms
5,952 KB
testcase_19 AC 12 ms
5,956 KB
testcase_20 RE -
testcase_21 AC 11 ms
5,988 KB
testcase_22 RE -
testcase_23 AC 11 ms
5,996 KB
testcase_24 AC 11 ms
5,852 KB
testcase_25 RE -
testcase_26 AC 12 ms
6,028 KB
testcase_27 AC 11 ms
5,888 KB
testcase_28 RE -
testcase_29 AC 11 ms
5,852 KB
testcase_30 RE -
testcase_31 AC 11 ms
5,896 KB
testcase_32 AC 11 ms
6,040 KB
testcase_33 AC 11 ms
6,032 KB
testcase_34 AC 11 ms
5,992 KB
testcase_35 AC 11 ms
5,864 KB
権限があれば一括ダウンロードができます

ソースコード

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