PersonalCorpus 版 (精华区)
39035 2002-10-05 22:27:48 Accepted
1337 C++ 00:00.00 388K Big Guava
int gcd(int a, int b)
{
while (a!=b) {
if (a%b==0) return b;
a%=b;
if (b%a==0) return a;
b%=a;
}
return a;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\uva\\input412.txt","r",stdin);
freopen("c:\\uva\\output412.txt","w",stdout);
#endif
int i,j,n,sum;
int a[50];
scanf("%d\n",&n);
while (n!=0) {
sum=0;
for (i=0;i<n;i++) {
scanf("%d\n",&a[i]);
for (j=0;j<i;j++) if (gcd(a[j],a[i])==1) sum++;
}
if (sum==0) printf("No estimate for this data set.\n"); else
printf("%.6lf\n",sqrt((double)(3*n*(n-1))/(double)(sum)));
scanf("%d\n",&n);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.894毫秒