fork download
  1. // Call of Duty Zombies Insta-Kill Round Calculator
  2. // author: R.B. (Reddit: DeadWireAintThatBad, YouTube: Red Baron 181)
  3.  
  4. #include <iostream>
  5.  
  6. int main() {
  7.  
  8. // int is 32-bit signed, which is the data type used for health in id Tech 3
  9. // round 1 health is 150
  10. int health = 150;
  11.  
  12. // round limit, this constant is used only to prevent an infinite loop
  13. const int rlimit = 300;
  14.  
  15. // health increases by +100 every round from 2 until 9
  16. for(int rnd = 2; rnd <= 9; rnd++)
  17. health += 100;
  18.  
  19. // health increases by x1.1 every round from 10 onwards
  20. for(int rnd = 10; rnd <= rlimit; rnd++) {
  21.  
  22. // this expression is used to avoid floating-point arithmetic
  23. // x + x/10 = x + 0.1x = 1.1x
  24. health += health / 10;
  25.  
  26. // if health overflows to negative, it's an insta-kill round
  27. // std::cout outputs the round number to stdout
  28. if(health < 0)
  29. std::cout << rnd << '\n';
  30.  
  31. }
  32.  
  33. // exit program
  34. return 0;
  35.  
  36. }
  37.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty