四大文化赛道完整展开
03-execution/run-001/source-snapshot/main.py
main.py
站内文件视图直接读取仓库内容,Markdown 使用文档排版渲染,其余文本文件保持原始排版,方便校对训练证据链。
文件类型.py
10-cases/s3-jh-04-eco-model/03-execution/run-001/source-snapshot/main.py
import sys
def level(score: float) -> str:
if score >= 85:
return "A"
if score >= 70:
return "B"
return "C"
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_score = -10 ** 18
levels = []
for _ in range(n):
name = next(it)
water = int(next(it))
trade = int(next(it))
vegetation = int(next(it))
score = water * 0.4 + trade * 0.35 + vegetation * 0.25
total += score
levels.append(f"{name}:{level(score)}")
if score > best_score or (abs(score - best_score) < 1e-9 and name < best_name):
best_name = name
best_score = score
return "\n".join(
[
f"best={best_name} {best_score:.2f}",
f"levels={','.join(levels)}",
f"average={total / n:.2f}",
]
)
if __name__ == "__main__":
sys.stdout.write(solve(sys.stdin.read()).strip())
sys.stdout.write("\n")