| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
怎么老错啊,各位帮帮忙!!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator