| ||||||||||
| 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>
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator