Advertisement
Alexzandur

10. Spice Must Flow

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