解题:苹果和虫子
2023-08-04 13:15:13
发布于:广东
134阅读
0回复
0点赞
空降坐标:CP003211
请看代码
#include <bits/stdc++.h>
using namespace std;
int main()
{
//n箱苹果,x小时吃一个,y小时后,剩s个
int s,n,x,y;
cin>>n>>x>>y;
if(y%x==0)
{
s=n-y/x;
}
else
{
s=(n-y/x)-1;
}
if(s>0)
{
cout<<s;
}
else
{
cout<<0;
}
return 0;
}
全部评论 1
#include <bits/stdc++.h>
using namespace std;
int main()
{
//n箱苹果,x小时吃一个,y小时后,剩s个
int s,n,x,y;
cin>>n>>x>>y;
if(y%x==0) s=n-y/x;
else s=(n-y/x)-1;
if(s>0) cout<<s;
else cout<<0;
return 0;
}2026-09-12 来自 浙江
0









有帮助,赞一个