Advertisement
Alexzandur

10. Spice Must Flow

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