输入包括两行: 第一行为序列长度n(1 ≤ n ≤ 50) 第二行为n个数sequence[i](1 ≤ sequence[i] ≤ 1000),以空格分隔
输出消除重复元素之后的序列,以空格分隔,行末无空格
9 100 100 100 99 99 99 100 100 100
99 100
var readline = require('readline') // var process = require() var ri = readline.createInterface({ input: process.stdin, output: process.stdout }) var is_firse_line = true var n = 0 ri.on('line', function (line) { if (is_firse_line) { n = parseInt(line) is_firse_line = false return } var nums = line.match(/(\d+) */g) nums = nums.map(function (data) { return parseFloat(data) }) var new_nums = [] for (var i = nums.length - 1; i >= 0; i --) { if (-1 === new_nums.indexOf(nums[i])) new_nums.unshift(nums[i]) } console.log(new_nums.join(' ')) })