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

怎么老错啊,各位帮帮忙!!!

Posted by 00448707 at 2005-04-27 14:16:24 on Problem 1862
#include<iostream.h>
#include<math.h>
#include<iomanip.h>
void main()
{
	int a,b[102],t;
	double c;
	cin>>a;
	for(int i=0;i<a;i++)
	{
		cin>>b[i];
	}
	if(a==1)cout<<b[0]<<endl;
	else{
	for(int j=1;j<a;j++)
	{
		for(int p=0;p<a-j;p++)
		{
			if(b[p]<b[p+1]){
				t=b[p];
				b[p]=b[p+1];
				b[p+1]=t;}
		}
	}
	c=2*sqrt(b[0]*b[1]);
	for(int y=2;y<a;y++)
	{
		c=2*sqrt(c*b[y]);
	}
	cout<<setiosflags(ios::fixed)<<setprecision(3)<<c<<endl;
	}
}

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