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/s4-jh-03-promotion-forecast/03-execution/run-001/source-snapshot/main.py

import sys


def round_half_up(total: int, count: int) -> int:
    return (2 * total + count) // (2 * count)


def solve(data: str) -> str:
    tokens = list(map(int, data.split()))
    if not tokens:
        return ""
    it = iter(tokens)
    n = next(it)
    visits = []
    total_visits = 0
    total_orders = 0
    best_day = 1
    best_orders = -1
    for day in range(1, n + 1):
        v = next(it)
        o = next(it)
        visits.append(v)
        total_visits += v
        total_orders += o
        if o > best_orders:
            best_orders = o
            best_day = day
    recent = visits[-min(3, n):]
    forecast_visits = round_half_up(sum(recent), len(recent))
    forecast_orders = round_half_up(forecast_visits * total_orders, total_visits)
    conversion = total_orders * 100.0 / total_visits
    return "\n".join(
        [
            f"conversion={conversion:.2f}",
            f"forecast={forecast_visits} {forecast_orders}",
            f"best_day={best_day}",
        ]
    )


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