Advertisement
Guest User

Untitled

a guest
Apr 9th, 2013
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3.  
  4. int main(void)
  5. {
  6. int levels = 40;
  7. int xp_for_first_level = 1000;
  8. int xp_for_last_level = 1000000;
  9.  
  10. double B = log((double)xp_for_last_level / xp_for_first_level) / (levels - 1);
  11. double A = (double)xp_for_first_level / (exp(B) - 1.0);
  12.  
  13. for (int i = 1; i <= levels; i++)
  14. {
  15. int old_xp = round(A * exp(B * (i - 1)));
  16. int new_xp = round(A * exp(B * i));
  17. std::cout << i << " " << (new_xp - old_xp) << std::endl;
  18. }
  19. }
  20. And the following output:
  21.  
  22. 1 1000 9 4125 17 17012 25 70170 33 289427
  23. 2 1193 10 4924 18 20309 26 83768 34 345511
  24. 3 1425 11 5878 19 24245 27 100000 35 412462
  25. 4 1702 12 7017 20 28943 28 119378 36 492389
  26. 5 2031 13 8377 21 34551 29 142510 37 587801
  27. 6 2424 14 10000 22 41246 30 170125 38 701704
  28. 7 2894 15 11938 23 49239 31 203092 39 837678
  29. 8 3455 16 14251 24 58780 32 242446 40 1000000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement