Advertisement
Farjana_akter

Untitled

May 30th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n,i,j,tpair,gpair=0,b,c,d;
  7. double ans;
  8. while(cin>>n && n)
  9. {
  10. int a[n+5];
  11. for(i=0;i<n;i++)
  12. cin>>a[i];
  13. tpair=(n*(n-1))/2;
  14. gpair=0;
  15. for(i=0;i<n-1;i++)
  16. {
  17. for(j=i+1;j<n;j++)
  18. {
  19. if(__gcd(a[i],a[j])==1)
  20. gpair++;
  21. }
  22. }
  23. if(gpair==0)
  24. cout<<"No estimate for this data set."<<endl;
  25. else
  26. {
  27. double x=tpair,y=gpair;
  28. ans=sqrt((x*6)/y);
  29. printf("%.6lf\n",ans);
  30. }
  31. }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement