Advertisement
-Annie-

SpiceMustFlow

Jun 1st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(startingYield) {
  2.     startingYield = Number.parseInt(startingYield);
  3.     let days = 0;
  4.     let total = 0;
  5.  
  6.     while(startingYield >= 100) {
  7.         days++;
  8.         total += startingYield;
  9.         startingYield -= 10;
  10.         total -= 26;
  11.     }
  12.  
  13.     total -= 26;
  14.     if (total < 0) {
  15.         total = 0;
  16.     }
  17.  
  18.     console.log(days);
  19.     console.log(total);
  20. }
  21.  
  22. solve(111);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement