結果
問題 | No.265 数学のテスト |
ユーザー |
|
提出日時 | 2016-10-25 23:29:35 |
言語 | PyPy2 (7.3.15) |
結果 |
AC
|
実行時間 | 334 ms / 2,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 1,750 ms |
コンパイル使用メモリ | 76,416 KB |
実行使用メモリ | 80,320 KB |
最終ジャッジ日時 | 2024-11-24 11:34:16 |
合計ジャッジ時間 | 5,944 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
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))