2 条题解
- 1
信息
- 编号
- 2300
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 2
- 标签
- 递交数
- 187
- 已通过
- 60
- 上传者
不是,安安是虫子吗
#include<bits/stdc++.h>
using namespace std;
int main()
{
double n,x,y;
cin>>n>>x>>y;
n-=ceil(y/x);
if( n<0)
{
n=0;
}
cout<<n;
return 0;
}
从洛谷来的,这题在洛谷叫P5709 【深基2.习6】Apples Prologue / 苹果和虫子,现在卡这了,在此寻解
#include <bits/stdc++.h>
using namespace std;
int main()
{
int m,t,s,a;
cin>>m>>t>>s;
//判断吃苹果是否需要时间
if(t==0)
{
cout<<0;
return 0;
}
//计算吃掉的苹果数量
if(s%t==0)
{
a=s/t;
} else {
a=s/t+1;
}
//判断剩余苹果数量
if(m>=a)
{
cout<<m;
} else {
cout<<0;
}
return 0;
}