1. 飞行棋分组
let nums = readline().split(' ').map(v => parseInt(v));
let map = new Map();
for(let i = 0; i < nums.length; i++) {
if (map.has(nums[i])) {
map.set(nums[i], map.get(nums[i]) + 1);
} else {
map.set(nums[i], 1);
}
}
let ans = true;
for(const [key, value] of map) {
if (value % 5 !== 0) {
ans = false;
break;
}
}
print(ans);
2. 金字塔
没有通过 j 优化会超时
let n = parseInt(readline());
let last = readline().split(' ').map(v => parseInt(v));
let ans = last.shift();
for(let i = 1; i < n; i++) {
let nums = readline().split(' ').map(v => parseInt(v));
let m = nums.shift();
let j = 0;
last = nums.reduce((pre, cur) => {
for(let k = j; k < last.length; k++) {
if (cur <= last[k] - 50) {
break;
}
if (k !== last.length && cur < last[k] + 100 && cur + 100 > last[k + 1]) {
pre.push(cur);
ans ++;
j = k;
break;
} else if ((cur >= last[k] && cur < last[k] + 50) || (cur + 100 > last[k] + 50 && cur <= last[k])) {
pre.push(cur);
ans ++;
j = k;
break;
}
}
return pre;
}, []);
}
print(ans);
#字节跳动笔试##字节跳动23秋招笔试心得体会#