//2587659 2011-07-20 15:22:47 Accepted 1337 C 150 160 ylwh!
#include <stdio.h>
#include <math.h>
int fun(int x, int y)
{
int i;
for(i=2; i<= (x>y?y:x); i++)
{
if(x%i==0 && y%i==0)
return 0;
}
return 1;
}
int main(void)
{
int n, i, j, count, total, a[51];
while(scanf("%d", &n) && n!=0)
{
count=0;
total=n*(n-1)/2;
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if(fun(a[i], a[j]) )
count++;
}
}
if(!count)
printf("No estimate for this data set.\n");
else
printf("%.6f\n", sqrt(total*1.0/count*6));
}
return 0;
}
zoj 1337
最新推荐文章于 2015-03-12 16:16:48 发布