World Robot Contest2025-2026Algorithm Application ThemeJunior Highwrc.hao.work
WRC
Contest Archive / Structured Dossiers青少年算法应用训练档案馆

把训练题、知识点、执行证据和最终解题档案统一归档成可直接浏览的竞赛资料库。

Archive30 Cases

四大文化赛道完整展开

AccessHTTPS

完整题面 / 题解 / 运行证据

No Rounded CornersTailwind FirstDossier Ready
03-execution/run-001/source-snapshot/main.py

main.py

站内文件视图直接读取仓库内容,Markdown 使用文档排版渲染,其余文本文件保持原始排版,方便校对训练证据链。

文件类型.py

10-cases/s2-jh-04-tactical-decision/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)
    food_cap = int(next(it))
    med_cap = int(next(it))
    n = int(next(it))
    feasible = 0
    best = None
    for _ in range(n):
        name = next(it)
        food = int(next(it))
        med = int(next(it))
        days = int(next(it))
        morale = int(next(it))
        if food > food_cap or med > med_cap:
            continue
        feasible += 1
        score = morale * 3 - days - food - med
        candidate = (-score, days, name, food_cap - food, med_cap - med, score, name)
        if best is None or candidate < best:
            best = candidate
    if best is None:
        return "\n".join(
            [
                "feasible=0",
                "best=NONE",
                f"reserve={food_cap} {med_cap}",
            ]
        )
    return "\n".join(
        [
            f"feasible={feasible}",
            f"best={best[6]} {best[5]}",
            f"reserve={best[3]} {best[4]}",
        ]
    )


if __name__ == "__main__":
    sys.stdout.write(solve(sys.stdin.read()).strip())
    sys.stdout.write("\n")