| ||||||||||
| 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 <stdio.h>
#include <cmath>
using namespace std;
int GCD(int a, int b){
if(a==0) return b;
if(b==0) return a;
if(a>b) return GCD(b, a%b);
return GCD(a, b%a);
}
int main() {
while(1){
int n;
scanf("%d", &n);
if(!n) return 0;
int a[500];
for(int i = 0; i < n; i++){
scanf("%d", &a[i]);
}
int T = 0;
for(int i = 0; i < n-1; i++){
for(int j = i+1; j < n; j++){
if(GCD(a[i], a[j]) == 1) T++;
}
}
if(!T){
printf("No estimate for this data set.\n");
}
else{
printf("%.6lf\n", sqrt(3*n*(n-1)/(T*1.0)));
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator