fork download
  1. //----->|try=0; while(!success) try++;|<------
  2. //----->|Belief Yourself,Respect Yourself|<----
  3. //----->|Be Proud Of Yourself,You're Doing Your best|<-----
  4. #include<bits/stdc++.h>
  5. using namespace std;
  6. #define uniq(x) x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
  7. #define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr //Upper value search;
  8. #define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr //Lower value search;
  9. #define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
  10. #define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
  11. #define PI acos(-1.0)//PI Calculation
  12. #define LL long long
  13. #define AND(a,b) ((a) & (b))
  14. #define OR(a,b) ((a)|(b))
  15. #define XOR(a,b) ((a) ^ (b))
  16. #define mp make_pair
  17. #define sqr(x) ((x)*(x))
  18. #define sqrt(x) sqrt(1.0*(x))
  19. #define INF_MAX 2147483647
  20. #define INF_MIN -2147483647
  21. #define MX 1000005
  22. #define MOD 1000000007
  23. template<typename T> T POW(T b,T p) //Pow calculation
  24. {
  25. T r=1;
  26. while(p)
  27. {
  28. if(p&1)r=(r*b);
  29. b=(b*b);
  30. p>>=1;
  31. }
  32. return r;
  33. }
  34.  
  35. int main()
  36. {
  37. //freopen("a.in", "r", stdin);
  38. //freopen("a.out", "w", stdout);
  39. double n,square_sum,odd_sum,average,res;
  40. while(scanf("%lf",&n) && n!=0)
  41. {
  42. square_sum=(4*n*n*n-n)/3;//finding odd square sum to 1 - n;
  43. odd_sum=n*n;//finding odd sum 1 to n;
  44. average=odd_sum*1.f/n;//finding average
  45. res=sqrt((square_sum-2*odd_sum*average+average*average*n)*1.f/(n-1));//finding standard devation;
  46. printf("%.6lf\n",res);
  47. }
  48. }
  49.  
  50.  
  51.  
Success #stdin #stdout 0s 3472KB
stdin
10
100
1000
10000
100000
1000000
0
stdout
6.055301
58.022984
577.638872
5773.791360
57735.315593
577350.557865