Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
89667 | 赵天瑜 | 07苹果和虫子 | C++ | Wrong Answer | 1 MS | 272 KB | 562 | 2024-08-28 13:54:12 |
#include <iostream> using namespace std; int main() { int n, x, y; int apples_eaten = 0; // 输入三个整数:苹果的初始数量,虫子吃一个苹果所需的小时数,以及经过的小时数 cin >> n >> x >> y; // 计算虫子吃掉的苹果数量 apples_eaten = y / x; // 计算剩余的苹果数量,如果剩余数量小于0,则为0 int remaining_apples = n > apples_eaten ? n - apples_eaten : 0; // 输出剩余的苹果数量 cout << remaining_apples << endl; return 0; }
------Input------
459 2 1
------Answer-----
458
------Your output-----
459