---[ apple & sum ] ---

Run Settings
LanguageJavaScript
Language Version
Run Command
function processData(input) { var count_a ,count_b,arr_apple ,arr_orange ,s_t ,a_b,new_arr_apple ,new_arr_orange; var arr = input.split('\n'); count_a = 0 ; count_b = 0 ; new_arr_apple = [] ; new_arr_orange = [] ; s_t = arr[0].split(' ');// 2 3// 7 11 a_b = arr[1].split(' ');// 1 5 // 5 15 m_n = arr[2].split(' ');// 1 1 // 3 2 arr_apple = arr[3].split(' '); // -2 // -2 2 1 arr_orange = arr[4].split(' '); // -1 // 5 -6 for (let i = 0; i <Number(m_n[0]) ; i++) { new_arr_apple[i] = Number(a_b[0]) + Number(arr_apple[i]); if (new_arr_apple[i] >= Number(s_t[0]) && new_arr_apple[i] <= Number(s_t[1])) { count_a++ } } for (let i = 0; i < Number(m_n[1]); i++) { new_arr_orange[i] = Number(a_b[1]) + Number(arr_orange[i]); if ( new_arr_orange[i] <= Number(s_t[1]) && new_arr_orange[i] >= Number(s_t[0]) ) { count_b++ } } console.log(count_a); console.log(count_b); } 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