- 问答
为啥是75啊?#652. 买铅笔
- 2023-11-17 12:12:56 @
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long shu,y,i,e,r,s,a,yi,er,san;//y、e、s数量i、r、a价格
cin>>shu>>y>>i>>e>>r>>s>>a;
if(shu % y==0)
{
yi=(shu/y)*i;
}
if(shu % y!=0)
{
int q;
q=shu / y;
q=q+1;
yi =q*i;
}
```
if(shu % e==0)
{
er=(shu/e)*r;
}
if(shu % e!=0)
{
int p;
p=shu / e;
p=p+1;
er =p*r;
}
if(shu % s==0)
{
san=(shu/s)*i;
}
if(shu % s!=0)
{
int o;
o=shu / s;
o=o+1;
san =o*a;
}
if(yi>er&&san>er)
{
cout<<er;
}
if (er>yi&&san>yi)
{
cout<<yi;
}
if(yi>san&&er>san)
{
cout<<san;
}
return 0;
```
}
0 comments
No comments so far...