Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,i,j,tpair,gpair=0,b,c,d;
- double ans;
- while(cin>>n && n)
- {
- int a[n+5];
- for(i=0;i<n;i++)
- cin>>a[i];
- tpair=(n*(n-1))/2;
- gpair=0;
- for(i=0;i<n-1;i++)
- {
- for(j=i+1;j<n;j++)
- {
- if(__gcd(a[i],a[j])==1)
- gpair++;
- }
- }
- if(gpair==0)
- cout<<"No estimate for this data set."<<endl;
- else
- {
- double x=tpair,y=gpair;
- ans=sqrt((x*6)/y);
- printf("%.6lf\n",ans);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement