Follows 412.c (Total 29 lines):

/* @JUDGE_ID:4461XX 412 C */
/* A */
#include <stdio.h>
#include <math.h>
int gcd(int a,int b);
void main(void)
{
	int n;
	while(scanf("%d",&n)==1)
	{
		int a[50],i,j,top=0;
		if(n==0)break;
		for(i=0;i<n;i++)scanf("%d",&a[i]);
		for(i=0;i<n-1;i++)
			for(j=i+1;j<n;j++)if(gcd(a[i],a[j])==1)top++;
		if(top==0)printf("No estimate for this data set.\n");
		else printf("%.6lf\n",sqrt((double)6*(((double)n*(n-1))/(double)2)/(double)top));
	}
}
int gcd(int a,int b)
{
	int temp;
	if(b>a){temp=a;a=b;b=temp;}
	while(b!=0)
	{
		temp=b;b=a%b;a=temp;
	}
	return a;
}

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com