#include <iostream>
using namespace std;
int main() {
int m, t, s;
cin >> m >> t >> s;
if (t == 0) {
// If eating takes 0 minutes, she eats all apples immediately
cout << 0 << endl;
return 0;
}
int eaten = s / t;
if (s % t != 0) {
eaten++; // she's in the process of eating the next apple
}
int remaining = m - eaten;
if (remaining < 0) {
remaining = 0; // she can't have negative apples left
}
cout << remaining << endl;
return 0;
}
Emotional damage why you guys all post the answer?
The people that don't know can not learn anything!
cpp复制#include using namespace std; int main() { int m, t, s; cin >> m >> t >> s; if (t == 0) { // If eating takes 0 minutes, she eats all apples immediately cout << 0 << endl; return 0; } int eaten = s / t; if (s % t != 0) { eaten++; // she's in the process of eating the next apple } int remaining = m - eaten; if (remaining < 0) { remaining = 0; // she can't have negative apples left } cout << remaining << endl; return 0; }
you are using ai and you use ai's program to get ac, so bad