結果

問題 No.265 数学のテスト
ユーザー nebukuro09nebukuro09
提出日時 2016-10-25 23:29:35
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 333 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 1,150 ms
コンパイル使用メモリ 77,828 KB
実行使用メモリ 80,692 KB
最終ジャッジ日時 2023-08-16 02:10:09
合計ジャッジ時間 6,147 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
80,612 KB
testcase_01 AC 333 ms
80,692 KB
testcase_02 AC 78 ms
79,808 KB
testcase_03 AC 88 ms
80,172 KB
testcase_04 AC 91 ms
79,700 KB
testcase_05 AC 91 ms
79,740 KB
testcase_06 AC 84 ms
79,856 KB
testcase_07 AC 89 ms
79,792 KB
testcase_08 AC 88 ms
79,688 KB
testcase_09 AC 83 ms
79,856 KB
testcase_10 AC 82 ms
79,632 KB
testcase_11 AC 88 ms
79,748 KB
testcase_12 AC 67 ms
76,512 KB
testcase_13 AC 80 ms
79,848 KB
testcase_14 AC 82 ms
79,532 KB
testcase_15 AC 70 ms
76,512 KB
testcase_16 AC 76 ms
79,428 KB
testcase_17 AC 69 ms
76,160 KB
testcase_18 AC 66 ms
76,160 KB
testcase_19 AC 67 ms
76,512 KB
testcase_20 AC 69 ms
76,484 KB
testcase_21 AC 67 ms
76,472 KB
testcase_22 AC 80 ms
79,496 KB
testcase_23 AC 68 ms
76,156 KB
testcase_24 AC 68 ms
76,484 KB
testcase_25 AC 87 ms
79,960 KB
testcase_26 AC 70 ms
76,276 KB
testcase_27 AC 71 ms
76,584 KB
testcase_28 AC 77 ms
78,656 KB
testcase_29 AC 71 ms
76,280 KB
testcase_30 AC 79 ms
78,740 KB
testcase_31 AC 71 ms
76,664 KB
testcase_32 AC 69 ms
76,500 KB
testcase_33 AC 70 ms
76,600 KB
testcase_34 AC 67 ms
76,332 KB
testcase_35 AC 73 ms
76,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
d = input()
S = filter(None, raw_input().replace('+', ' ').replace('d{', ' { ').replace('}', ' } ').split())
coef = [0 for i in xrange(d+1)]
dx = 0

for s in S:
    if s == '{':
        dx += 1
    elif s == '}':
        dx -= 1
    else:
        t = sorted(s.split('*'))
        if t[0].isdigit():
            c = int(t[0])
            t.pop(0)
        else:
            c = 1
        for i in xrange(len(t), len(t)-dx, -1):
            c *= i
        e = len(t) - dx
        if e >= 0:
            coef[e] += c
print ' '.join(map(str, coef))
0