Skip to content

Instantly share code, notes, and snippets.

Created Sep 13, 2020
What would you like to do?
* This sample code is also a solution to the problem at the following URL of atcoder.
"use strict"
function Main(input) {
// Recieve input
let lines = input.split('\n');
const [a, b, c, d] = lines[0].split(' ').map(BigInt);
// Process data
let product_matrix = [];
product_matrix.push(a * c);
product_matrix.push(a * d);
product_matrix.push(b * c);
product_matrix.push(b * d);
const max = product_matrix.reduce((a,b)=>a>b?a:b)
// Print output
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment