PROBLEM 76
Medium

Free Delivery

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#76

Given order `amount` and `premium` flag 0/1. Delivery is free if amount≥3000 or premium is active.

EXAMPLE

Example

Input
1200 1
Output
FREE

LIMITS

Constraints

amount ≥ 0; premium ∈ {0,1}
📖
LEARN Theory for this problem
+

### Free Delivery

`if / else if / else` chooses a branch from boolean conditions. Comparisons such as `<`, `>=`, `===` and logical operators `&&`, `||`, `!` combine the exact rules that decide which output is valid.

💡
NEED HELP? Hints
+

['Translate every case from the statement into a boolean condition before writing branches.', 'After each iteration, it should be clear what has already been accumulated and what remains to be processed.']

ANSWER Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let [a, p] = input.trim().split(/\s+/).filter(Boolean).map(Number);
if ((a >= 3000) || ((p) === (1))) {
    console.log("FREE");
} else {
    console.log("PAID");
}