var str = read_line(); var arr = str.split(' '); //转为整数 arr = arr.map(function(item,index){ return +item; }); //排序 arr.sort(function(a,b){return a- b}); var mid = arr.length % 2 == 0 ? (arr[Math.floor(arr.length / 2) - 1] + arr[Math.floor(arr.length / 2)]) / 2 : arr[Math.floor(arr.length / 2)]; print(mid);
点赞 评论

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务