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

Re:小弟很菜,望大牛帮忙看一下错在哪里?

Posted by ecjtubaowp at 2007-03-05 00:50:16 on Problem 1862
In Reply To:小弟很菜,望大牛帮忙看一下错在哪里? Posted by:smark at 2007-03-04 23:33:17
> #include<iostream.h>
> #include<math.h>
> #include<stdio.h>
> 
> int main()
> {
> 	int t,a[101];
> 	double res;
> 	cin>>t;
> 	if(t>1)
> 	{
> 		for(int i=0;i<t;i++)
> 		{
> 			cin>>a[i];
> 		}
> 
> 		for(i=0;i<=t-1;i++)
> 		{
> 			for(int j=t;j>=i+1;j--)
> 			{
> 				if(a[j]>a[j-1])
> 				{
> 					int temp;
> 					temp=a[j];
> 					a[j]=a[j-1];
> 					a[j-1]=temp;
> 				}
> 			}
> 		}//排序有问题
> 		res=2*sqrt(a[0]*a[1]);
> 		if(t>2)
> 		{
> 			for(i=2;i<t;i++)
> 			{
> 				res=2*sqrt(res*a[i]);
> 			}
> 	}
> 	printf("%.3f\n",res);
> 	}
> 	else if(t==1)
> 	{
> 		cin>>res;
> 		printf("%.3f\n",res);
> 	}
> 	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