Skip to content

Instantly share code, notes, and snippets.

@shinchit
Created September 13, 2020 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinchit/6e42d7b4a28f64970ecc647565a7cd07 to your computer and use it in GitHub Desktop.
Save shinchit/6e42d7b4a28f64970ecc647565a7cd07 to your computer and use it in GitHub Desktop.
/*
* This sample code is also a solution to the problem at the following URL of atcoder.
* https://atcoder.jp/contests/abc178/tasks/abc178_b
*/
"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
console.log(max.toString());
}
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