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

why wrong

Posted by yzhw at 2009-04-05 15:17:15
# include <iostream>
#include<cmath>
using namespace std;

int main()
{
	int n;double  a[20][2];double s;int a0,a1,a2,a3,a4,a5,a6,a7,a8,a9;int f=0;

	while(cin>>n)
	 
		
	{
		for(int i=0;i<n;i++)
		{
			cin>>a[i][0];
			cin>>a[i][1];
		}
		for( a0=1;a0<=10;a0++)
		  for( a1=a0;a1<=10;a1++)
			for( a2=a1;a2<=10;a2++)
				for( a3=a2;a3<=10;a3++)
					for( a4=a3;a4<=10;a4++)
						for( a5=a4;a5<=10;a5++)
							for( a6=a5;a6<=10;a6++)
								for( a7=a6;a7<=10;a7++)
                                      for( a8=a7;a8<=10;a8++)
										  for( a9=a8;a9<=10;a9++)
											 
										  {
											  f=0;
											  for(int i=0;i<n;i++)
											  {
											s=exp(a0*a[i][0])+exp(a1*a[i][0])+exp(a2*a[i][0])+exp(a3*a[i][0])
											  +exp(a4*a[i][0])+exp(a5*a[i][0])+exp(a6*a[i][0])+exp(a7*a[i][0])
											  +exp(a8*a[i][0])+exp(a9*a[i][0]);
                                               if(abs(s-a[i][1])>=0.002)
											    {   
												 f=1;
												 break;
											    }
											  }
											  if(f==0)goto h;
										  }
h:    cout<<a0<<endl;
      cout<<a1<<endl;
	  cout<<a2<<endl;
	  cout<<a3<<endl;
	  cout<<a4<<endl;
	  cout<<a5<<endl;
      cout<<a6<<endl;
      cout<<a7<<endl;
	  cout<<a8<<endl;
	  cout<<a9<<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