Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- const priceStrawberry = 3.50;
- const priceBlueberry = 5.00;
- const rows = Number(input[0]);
- const columns = Number(input[1]);
- let countStrawberry = 0;
- let countBlueberry = 0;
- for (let row = 1; row <= rows; row++) {
- if (row % 2 !== 0) {
- countStrawberry += columns;
- continue;
- }
- for (let col = 1; col <= columns; col++) {
- if (col % 3 !== 0) {
- countBlueberry++;
- }
- }
- }
- const profit = (countStrawberry * priceStrawberry + countBlueberry * priceBlueberry) * 0.8;
- console.log(`Total: ${profit.toFixed(2)} lv.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement