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 yanzhu at 2009-03-21 16:50:34 on Problem 1862
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,a[100],t;
	float s;
	//while(cin>>n)
	cin>>n;
	if(n==1)
	{cin>>a[0];
		s=sqrt(double(a[0]));
	}
	else
	{
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int x=0;x<n-1;x++)
		for(int y=x;y<n-1-x;y++)
			if(a[y]<a[y+1])
			{
				t=a[y];
				a[y]=a[y+1];
				a[y+1]=t;
			}
			s=sqrt(double(a[0])*double(a[1]));
		
	}	printf("%.3f\n",2*s);
			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