diff --git a/pages/students/2016/jan_holp/dp2021/zdrojove_subory/answer.js b/pages/students/2016/jan_holp/dp2021/zdrojove_subory/answer.js new file mode 100644 index 0000000000..89acc47be7 --- /dev/null +++ b/pages/students/2016/jan_holp/dp2021/zdrojove_subory/answer.js @@ -0,0 +1,44 @@ + +const fs = require('fs'); +const readline = require('readline'); + + +var result = []; + + + +const readInterface = readline.createInterface({ + input : fs.createReadStream('/home/elastic/BP/skweb/server/scnc2/answers'), + console : false +}); + + +readInterface.on('line', function(line){ + var tokens = line.split(" "); + var id_query = parseInt(tokens[0]); + var id_document = parseInt(tokens[1]); +// console.log([id_query]); + + if (!(id_query in result)){ + result[id_query]=[id_document]; + } + else { + result[id_query].push(id_document); + } + + + +// console.log(result); +}); + + +readInterface.on('close', function() { + for (let i = 0 ; i < result.length; i++){ + + console.log(i); + console.log(result[i]); + } + console.log("koniec"); +}); + +