四大文化赛道完整展开
03-execution/run-001/source-snapshot/main.py
main.py
站内文件视图直接读取仓库内容,Markdown 使用文档排版渲染,其余文本文件保持原始排版,方便校对训练证据链。
文件类型.py
10-cases/s1-jh-02-heritage-simulation/03-execution/run-001/source-snapshot/main.py
import sys
def solve(data: str) -> str:
tokens = list(map(int, data.split()))
if not tokens:
return ""
it = iter(tokens)
days = next(it)
stock = next(it)
threshold = next(it)
support = next(it)
support_count = 0
lowest_stock = 10 ** 18
lowest_day = 1
for day in range(1, days + 1):
produce = next(it)
consume = next(it)
damage = next(it)
stock += produce - consume - damage
if stock < lowest_stock:
lowest_stock = stock
lowest_day = day
if stock < threshold:
stock += support
support_count += 1
return "\n".join(
[
f"final_stock={stock}",
f"support_count={support_count}",
f"lowest_stock={lowest_stock} day={lowest_day}",
]
)
if __name__ == "__main__":
sys.stdout.write(solve(sys.stdin.read()).strip())
sys.stdout.write("\n")