daily pastebin goal
1%
SHARE
TWEET

[C++] STO Upgrading Calculator

keverman Oct 24th, 2018 (edited) 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. int main()
  4. {
  5.     int lvls = 6;
  6.     double tech = 4;
  7.     double accelerator = 2;
  8.     double qualprob = tech * accelerator;
  9.     double res[4] = {0, 1, 0, 0}, prob[4];
  10.  
  11.     for(int i = 0; i < 3; i++)
  12.         prob[i] = (0.1 / pow(2, i) * qualprob);
  13.  
  14.     prob[3] = 1;
  15.  
  16.     for(int i = 0; i < lvls; i++)
  17.     {
  18.         res[3] += res[2] * prob[2];
  19.         res[2] = res[2] * (1.0 - prob[2]) + res[1] * prob[1];
  20.         res[1] = res[1] * (1.0 - prob[1]) + res[0] * prob[0];
  21.         res[0] *= (1.0 - prob[0]);
  22.     }
  23.  
  24.     for(int i = 0; i < 4; i++)
  25.         printf("%.1f ", res[i] * 100);
  26. }
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