Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

改了还wa??

Posted by y05zh at 2006-08-19 17:25:18 on Problem 2980
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator