题解 P5709 【【深基2.习6】Apples Prologue】

ShineEternal

2019-12-21 21:00:37

Solution

用总时间除以每个苹果用的时间就是吃掉的苹果个数,因为最后是完整的所以可能要-1,然后就是如果0分钟一个苹果时输出原来的苹果个数就行了。 ```cpp #include<cstdio> #include<algorithm> using namespace std; int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); if(b==0) { printf("%d\n",a); return 0; } int d=c/b; if(c%b!=0) { printf("%d\n",max(0,a-d-1)); return 0; } printf("%d\n",max(0,a-d)); return 0; } ```