SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. /// Typedef
  6. typedef long long ll;
  7.  
  8. #define sc1(a) scanf("%lld",&a)
  9. #define sc2(a,b) scanf("%lld %lld",&a,&b)
  10.  
  11. #define pf1(a) printf("%lld\n", a)
  12. #define pf2(a,b) printf("%lld %lld\n",a,b)
  13.  
  14. #define mx 10000007
  15. #define mod 1000000007
  16. #define PI acos(-1.0)
  17.  
  18. #define size1 1000007
  19.  
  20. int drx[8] = {-2,-2,-1,-1,1,1,2,2};
  21. int dcy[8] = {-1,1,-2,2,-2,2,-1,1};
  22.  
  23. int dirx[4] = { -1, 0, 1, 0 };
  24. int diry[4] = { 0, -1, 0, 1 };
  25.  
  26.  
  27. ll gcd(ll a,ll b){ if(b == 0) return a; return gcd(b, a % b); }
  28. ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
  29.  
  30.  
  31. int main()
  32. {
  33.  
  34.     ll tc, num, t = 1, pownum;
  35.  
  36.     // freopen("/opt/Coding/clion code/input.txt", "r", stdin);
  37.     // freopen("/opt/Coding/clion code/output.txt", "w", stdout);
  38.  
  39.     while (cin >> num){
  40.  
  41.         if(num <= 1 || num >= 50) break;
  42.  
  43.         ll arr[num];
  44.  
  45.         for(ll i = 0; i < num; i++)
  46.             sc1(arr[i]);
  47.  
  48.         ll cnt = 0;
  49.         for(ll i = 0; i < num - 1; i++){
  50.             for(ll j = i + 1; j < num; j++){
  51.                 if(gcd(arr[i], arr[j]) == 1) cnt++;
  52.             }
  53.         }
  54.  
  55.         if(cnt == 0) cout << "No estimate for this data set." << endl;
  56.         else{
  57.  
  58.             ll sum = num * (num - 1) / 2;
  59.  
  60.             double ans = sqrt((6.0 * sum) / cnt);
  61.  
  62.             printf("%.6lf\n", ans);
  63.  
  64.         }
  65.  
  66.     }
  67.  
  68.     return 0;
  69. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top