| ||||||||||
| 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 | |||||||||
数据都过了,但是GCC,G++不能过的注意了,把double改为float就能过,或者换成c++也就能过了把double改为float就能过,或者换成c++也就能过了
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int cmp ( const void *a , const void *b )
{
return *(float *)b - *(float *)a;
}
int main()
{
float s,a[1000];
int n,i;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%f",&a[i]);
}
qsort(a,n,sizeof(a[0]),cmp);
s=a[0];
for(i=1;i<n;i++)
{
s=2.0*sqrt(s*a[i]);
}
printf("%.3f\n",s);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator