結果

問題 No.265 数学のテスト
ユーザー matsu7874matsu7874
提出日時 2015-08-07 23:24:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,016 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 8,440 KB
最終ジャッジ日時 2023-09-25 06:23:19
合計ジャッジ時間 2,139 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 25 ms
8,440 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 23 ms
8,328 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 24 ms
8,332 KB
testcase_09 RE -
testcase_10 AC 22 ms
8,248 KB
testcase_11 RE -
testcase_12 AC 15 ms
7,812 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 16 ms
7,852 KB
testcase_16 AC 17 ms
7,768 KB
testcase_17 AC 16 ms
7,768 KB
testcase_18 AC 15 ms
7,812 KB
testcase_19 AC 15 ms
7,880 KB
testcase_20 RE -
testcase_21 AC 16 ms
7,972 KB
testcase_22 RE -
testcase_23 AC 15 ms
7,784 KB
testcase_24 AC 15 ms
7,968 KB
testcase_25 RE -
testcase_26 AC 16 ms
7,956 KB
testcase_27 AC 16 ms
7,800 KB
testcase_28 RE -
testcase_29 AC 16 ms
7,788 KB
testcase_30 RE -
testcase_31 AC 16 ms
7,900 KB
testcase_32 AC 16 ms
7,824 KB
testcase_33 AC 16 ms
7,884 KB
testcase_34 AC 16 ms
7,824 KB
testcase_35 AC 16 ms
7,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def bibun(n,c):
    if n<c:
        return 0
    res = 1
    for i in range(c):
        res *= n
        n -= 1
    return res

def main():
    N = int(input())
    d = int(input())
    S = input()
    A = [0 for i in range(d+1)]
    d_cnt = 0
    x_cnt = 0
    a = 0
    pre = ''
    for s in S:
        if s in '123456789':
            if a==0:
                a=1
            a *= int(s)
        elif s == '{':
            d_cnt += 1
        elif s == '}':
            A[x_cnt-d_cnt] += a*bibun(x_cnt, d_cnt)
            x_cnt = 0
            a = 0
            d_cnt -= 1
        elif s == '*':
            pass
        elif s == '+':
            A[x_cnt-d_cnt] += a*bibun(x_cnt, d_cnt)
            x_cnt = 0
            a = 0
        elif s == 'x':
            x_cnt += 1
            if a == 0:
                a = 1
    A[x_cnt - d_cnt] += a * bibun(x_cnt, d_cnt)
    x_cnt = 0
    a = 1

    ans = ''
    for ai in A:
        ans += str(ai) + ' '
    print(ans[:-1])





if __name__ == '__main__':
    main()
0