Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
115248 胡海峰老师 14经过路口 C Accepted 0 MS 188 KB 416 2025-03-29 20:53:35

Tests(1/1):


Code:

#include <stdio.h> int main() { double cash = 100000; // 初始现金 int crossings = 0; // 经过路口次数 while (1) { if (cash > 50000) { cash -= cash * 0.05; // 扣除 5% } else { cash -= 5000; // 扣除 5000 元 } if (cash<0) break; crossings++; // 经过路口次数加 1 } printf("%d", crossings); return 0; }