My issue
how to take inputs in js
My code
// your code goes here
function canDefeatMonster(H, X, Y) {
return (X - Y) >= 0 ? 1 : 0;
}
// Read input and process test cases
function main() {
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('', (T) => {
for (let i = 0; i < T; i++) {
rl.question('', (testCase) => {
const [H, X, Y] = testCase.split(' ').map(Number);
const result = canDefeatMonster(H, X, Y);
console.log(result);
if (i === T - 1) {
rl.close();
}
});
}
});
}
main();
Problem Link: CodeChef: Practical coding for everyone