中级
实现CPT计费模型计算
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
bc_csv = open_url(____).read()
configs = pd.read_csv(StringIO(____))
cpt = configs[configs['____']=='____']
SLOTS = {'____':____,'____':____,'____':____,'____':____}
def calc_cpt(____):
cfg = cpt[cpt['____']==cfg_id]
if cfg.empty or slot not in SLOTS: return None
price = float(____)
return {'____':slot,'____':days,'____':price,'____':round(____)}
print(____)
for slot, days, cfg_id in [(____),(____),(____)]:
r = calc_cpt(____)
if r: print("____"+r['____']+"____"+str(____)+"____"+str(____)+"____"+str(____)+"____")
示例
输入
solve()
期望输出
CPT billing: morning_peak days=30 price=500.0/day -> cost=15000.0 CNY noon days=14 price=200.0/day -> cost=2800.0 CNY evening_peak days=7 price=500.0/day -> cost=3500.0 CNY
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199