結果
| 問題 |
No.265 数学のテスト
|
| コンテスト | |
| ユーザー |
damin
|
| 提出日時 | 2020-11-04 03:37:26 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,299 bytes |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-07-22 09:38:26 |
| 合計ジャッジ時間 | 3,151 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 RE * 2 |
ソースコード
import sys
try:
import os
f = open('input.txt', 'r')
sys.stdin = f
except FileNotFoundError:
None
from math import sqrt, ceil
input=lambda: sys.stdin.readline().strip()
n= int(input())
d=int(input())
s=input()
now=0
# ji = {i:0 for i in range(d+1)}
def gousei(di,dii):
return {i:di[i]+dii[i] for i in range(d+1)}
def bibun(di):
ans = {i:0 for i in range(d+1)}
for i in range(d):
ans[i] = di[i+1]*(i+1)
ans[d]=0
return ans
# print(gousei({0:3,1:2,2:4,3:0,},{0:2,1:2,2:4,3:4}))
def shin():
global now
ans = expr()
while now<n and s[now]=="+":
now+=1
ans = gousei(ans,expr())
# print(ans,now)
return ans
def expr():
global now
# jitmp = {i:0 for i in range(d+1)}
if s[now]=="d":
now+=2
jit = shin()
now+=1
return bibun(jit)
else:
return term()
def term():
global now
ji=0 ; kei=1
ans = {i:0 for i in range(d+1)}
if s[now]=="x":
ji+=1
else:
kei*=int(s[now])
now+=1
while now< n and s[now]=="*":
now+=1
if s[now]=="x":
ji+=1
now+=1
else:
kei*=int(s[now])
now+=1
ans[ji]=kei
return ans
last = shin()
print(*[last[i] for i in range(d+1)])
damin