| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
改了还wa??#include<iostream.h>
#include<math.h>
int main()
{
int n1,n2,n0,r;
int i;
while(cin>>n1>>n2>>n0>>r)
{
if(n1==0&&n2==0&&n0==0&&r==0)
{
break;
}
int day1=0,day2=0,day0=0;
int c[110]={0};
for(i=0;i<=ceil(100/(r+2));i++)
{
day0=n0*ceil(100/r);
day1=n1*(i+ceil( ceil((100-i*(r+2))/r) ));
day2=n2*(i +ceil(ceil(100-i*(r-1))/r));
/* if(i==ceil(100/(r+2)))
{
cout<<day2<<" " <<ceil(ceil(100-i*(r-1))/r)<<endl;
cout<<i<<endl;
}*/
c[i]=day0+day1+day2;
}
int min=c[0];
/* for(i=0;i<=ceil(100/(r+2));i++)
{
cout<<c[i]<<endl;
}*/
//cout<<endl;
for(i=0;i<=ceil(100/(r+2));i++)
{
if(c[i]<min)
{
min=c[i];
}
}
cout<<min<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator