Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
142289 胡海峰老师 07苹果和虫子 C++ Accepted 0 MS 272 KB 373 2026-01-05 12:25:15

Tests(10/10):


Code:

#include <iostream> //designed by hu 2025-10 using namespace std; int main(){ int n,x,y; cin>>n>>x>>y; int a,b =0 ; //计算 经过y小时,吃掉的苹果的数量 a = y/x; if(y%x>0) { b =1; } int c; c = n - a - b; //剩下的完整的苹果数量 if(c<0){ cout<< 0; } else{ cout << c; } return 0; }