Advertisement
RRusev77

10.Spice must flow

May 29th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(num) {
  2.     spiceYield = Number(num);
  3.     let days = 0;
  4.     let totalYield = 0;
  5.  
  6.     while(true) {
  7.         if(spiceYield < 100) {
  8.             if(totalYield - 26 >= 0) {
  9.                 totalYield -= 26;
  10.             }
  11.             break;
  12.         } else {
  13.             days++;
  14.         }
  15.  
  16.         totalYield = totalYield + (spiceYield - 26);
  17.  
  18.         spiceYield -= 10;
  19.     }
  20.  
  21.     console.log(days);
  22.     console.log(totalYield);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement