Skip to content

Instantly share code, notes, and snippets.

@shinchit
Created Sep 13, 2020
Embed
What would you like to do?
/*
* 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