| ||||||||||
| 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<string>
#include<stdio.h>
#include<cmath>
#include<iostream>
using namespace std;
bool haha(int a,int b)
{
if(a>b) a=b;
if((a==1)||(b==1)) return false;
if(a==b) return true;
for(int i=2;i<=a;i++)
if((a%i==0)&&(b%i==0)) return true;
return false;
}
int main()
{
int a[50];
int i,j,suma,sumb,n;
while(cin>>n&&n)
{
suma=0;
sumb=(n-1)*n/2;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(haha(a[i],a[j])==0) suma++;
double t=sqrt(6.0*sumb/suma);
if(suma==0) {printf("No estimate for this data set.\n");continue;}
printf("%.6f\n",t);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator