四大文化赛道完整展开
03-execution/run-001/source-snapshot/main.py
main.py
站内文件视图直接读取仓库内容,Markdown 使用文档排版渲染,其余文本文件保持原始排版,方便校对训练证据链。
文件类型.py
10-cases/s3-jh-01-trade-conversion/03-execution/run-001/source-snapshot/main.py
import sys
def solve(data: str) -> str:
tokens = data.split()
if not tokens:
return ""
it = iter(tokens)
n = int(next(it))
total = 0.0
best_name = ""
best_value = -10 ** 18
for _ in range(n):
name = next(it)
amount = float(next(it))
rate = float(next(it))
fee = int(next(it))
transport = float(next(it))
value = amount * rate * (100 - fee) / 100.0 - transport
total += value
if value > best_value or (abs(value - best_value) < 1e-9 and name < best_name):
best_name = name
best_value = value
return "\n".join(
[
f"total_settlement={total:.2f}",
f"best_item={best_name} {best_value:.2f}",
]
)
if __name__ == "__main__":
sys.stdout.write(solve(sys.stdin.read()).strip())
sys.stdout.write("\n")