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

Tests(1/1):


Code:

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