Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
104702 | 彭士宝 | 07苹果和虫子 | C++ | Wrong Answer | 1 MS | 272 KB | 553 | 2025-01-08 20:13:50 |
#include <iostream> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; // 读取苹果的数量n,虫子吃苹果的速率x,总时间y // 计算虫子在y小时内能吃的苹果数量 int applesEaten = y / x; // 计算剩余的苹果数量 int remainingApples = n - applesEaten; // 如果剩余苹果数量小于0,则为0 if (remainingApples < 0) { remainingApples = 0; } // 输出剩余的苹果数量 cout << remainingApples << endl; return 0; }
------Input------
459 2 1
------Answer-----
458
------Your output-----
459