Guest User

Universe is random, But is it?

a guest
Nov 16th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define sp << " " <<
  6. #define mod 1000000007
  7. #define mp make_pair
  8. #define pb push_back
  9. #define int long long
  10. #define double long double
  11. #define INF 1e18
  12. #define PI 3.14159265359
  13.  
  14. int power(int p,int y)
  15. {
  16. int res=1;
  17. p=p%mod;
  18. while(y>0)
  19. {
  20. if(y&1)
  21. res=(res*p)%mod;
  22. y=y>>1;
  23. p=(p*p)%mod;
  24. }
  25. return res;
  26. }
  27.  
  28. /*
  29. mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  30.  
  31. int dice()
  32. {
  33. uniform_int_distribution<int> uid(0,1);//specify l and r.
  34. return uid(rng) ;
  35. }
  36.  
  37. int read()
  38. {
  39. int cc = getc(stdin);
  40. for (;cc < '0' || cc > '9';) cc = getc(stdin);
  41. int dp = 0;
  42. for (;cc >= '0' && cc <= '9';)
  43. {
  44. dp = dp * 10 + cc - '0';
  45. cc = getc(stdin);
  46. }
  47. return dp;
  48. }
  49.  
  50. inline void print(int n)
  51. {
  52. if (n == 0)
  53. {
  54. putchar('0');
  55. putchar('\n');
  56. }
  57. else if (n == -1)
  58. {
  59. putchar('-');
  60. putchar('1');
  61. putchar('\n');
  62. }
  63. else
  64. {
  65. char buf[20];
  66. buf[19] = '\n';
  67. int i = 18;
  68. while (n)
  69. {
  70. buf[i--] = n % 10 + '0';
  71. n /= 10;
  72. }
  73. while (buf[i] != '\n')
  74. putchar(buf[++i]);
  75. }
  76. }
  77.  
  78. int n;
  79.  
  80. vector<vector<int>> mat_mul(vector<vector<int>> a,vector<vector<int>> b)
  81. {
  82. int n=5;
  83. vector<vector<int>> t(n,vector<int>(n,0));
  84. for(int i=0;i<n;i++)
  85. {
  86. for(int j=0;j<n;j++)
  87. {
  88. for(int k=0;k<n;k++)
  89. {
  90. t[i][j]+=((a[i][k]*b[k][j])%mod);
  91. t[i][j]%=mod;
  92. }
  93. }
  94. }
  95. return t;
  96. }
  97.  
  98. vector<vector<int>> pow_mat(vector<vector<int>> mat_a,int p)
  99. {
  100. if(p==1)
  101. return mat_a;
  102. vector<vector<int>> temp=pow_mat(mat_a,p/2);
  103. vector<vector<int>> res=mat_mul(temp,temp);
  104. if(p&1)
  105. res=mat_mul(res,mat_a);
  106. return res;
  107. }
  108. */
  109.  
  110. int32_t main()
  111. {
  112. ios::sync_with_stdio(false);
  113. cin.tie(0);
  114. cout.tie(0);
  115. freopen("sample_input.txt", "r", stdin);
  116. freopen("sample_output.txt", "w", stdout);
  117. int n,k,e;
  118. double m;
  119. cin >> n >> m >> k >> e;
  120. double dp=(double)m/2;
  121. for(int i=0;i<k;i++)
  122. {
  123. double d=floor(dp);
  124. dp=((d+1)*dp+(m*(m+1))/2-(d*(d+1))/2)/(m+1);
  125. }
  126. cout << fixed << setprecision(6) << dp;
  127. return 0;
  128. }
Add Comment
Please, Sign In to add comment