跳到正文

题解

P5709 【深基2.习6】Apples Prologue / 苹果和虫子

Love5201314约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
题目
P5709

版本

  1. v1当前
C++
#include<bits/stdc++.h>  //知道吧
using namespace std;  //不说了
int m,t,s;  //定义三个全局变量
int main()
{
	cin>>m>>t>>s;  //输入
	if(t==0) //如果速度为0,那么就是一个苹果也没吃
	{
		cout<<0<<endl;
		return 0;
	}
	if(s%t==0)  //一个苹果没剩
		cout<<max(m-s/t,0)<<endl;
	else  //剩了
		cout<<max(m-s/t-1,0)<<endl;
	return 0;
}
原文