arr +++

Run Settings
LanguageJavaScript
Language Version
Run Command
// 1 3 2 6 1 2 function processData(input) { array = input.split("\n") n_k = array[0].split(" ") k = Number(n_k[1]) arr = array[1].split(" ") count = 0 for (let i = 0; i < arr.length; i++) { for (let j = i + 1; j < arr.length; j++) { if ((Number(arr[i]) + Number(arr[j])) % k == 0 ) { count++ } } } console.log(count) } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); });
Editor Settings
Theme
Key bindings
Full width
Lines