Advertisement
Guest User

Untitled

a guest
Oct 9th, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.   const priceStrawberry = 3.50;
  3.   const priceBlueberry = 5.00;
  4.  
  5.   const rows = Number(input[0]);
  6.   const columns = Number(input[1]);
  7.  
  8.   let countStrawberry = 0;
  9.   let countBlueberry = 0;
  10.  
  11.   for (let row = 1; row <= rows; row++) {
  12.     if (row % 2 !== 0) {
  13.       countStrawberry += columns;
  14.       continue;
  15.     }
  16.  
  17.     for (let col = 1; col <= columns; col++) {
  18.       if (col % 3 !== 0) {
  19.         countBlueberry++;
  20.       }
  21.     }
  22.   }
  23.  
  24.   const profit = (countStrawberry * priceStrawberry + countBlueberry * priceBlueberry) * 0.8;
  25.  
  26.   console.log(`Total: ${profit.toFixed(2)} lv.`);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement