Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function happyCatParking(input) {
- let days = Number(input[0]);
- let hours = Number(input[1]);
- let total = 0;
- for (let day = 1; day <= days; day++) {
- let sum = 0;
- for (let hour = 1; hour <= hours; hour++) {
- if (day % 2 === 0 && hour % 2 === 1) {
- sum += 2.50;
- } else if (day % 2 === 1 && hour % 2 === 0) {
- sum += 1.25;
- } else {
- sum++;
- }
- }
- console.log(`Day: ${day} - ${sum.toFixed(2)} leva`);
- total += sum;
- }
- console.log(`Total: ${total.toFixed(2)} leva`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement