結果
| 問題 | No.265 数学のテスト |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-08-07 23:00:53 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 366 ms / 2,000 ms |
| コード長 | 661 bytes |
| 記録 | |
| コンパイル時間 | 137 ms |
| コンパイル使用メモリ | 77,592 KB |
| 最終ジャッジ日時 | 2025-12-03 16:08:57 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
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))