Advertisement
svetlio_top

Untitled

Jan 21st, 2020
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function solve(input){
  2. let Day = 0;
  3. let Totallv = 0;
  4. let DayLv = 0;
  5. let TotalBitCoins=0;
  6. let DayFirstB=0;
  7.  
  8. for(let i=0; i<input.length; i++){
  9. DayLv = 0;
  10. Day++;
  11. if(Day === 3){
  12. input[i] = input[i]-input[i]*30/100;
  13. }
  14. DayLv = input[i]*67.51;
  15. Totallv += DayLv;
  16.  
  17. while (Totallv>=11949.16){
  18. if(DayFirstB===0){
  19. DayFirstB = Day;
  20. }
  21. TotalBitCoins++;
  22. Totallv -= 11949.16;
  23. }
  24.  
  25. }
  26. console.log(`Bought bitcoins: ${TotalBitCoins}`);
  27. if(DayFirstB>0){
  28. console.log(`Day of the first purchased bitcoin: ${DayFirstB}`);
  29. }
  30. console.log(`Left money: ${Totallv.toFixed(2)} lv.`);
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement