牛客971465536号
牛客971465536号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客971465536号的博客
全部文章
/ 题解
(共50篇)
题解 | #简单密码#
//总感觉这么列出来有点傻 let str = 'abcdefghijklmnopqrstuvwxyz'; let book = { 2: 'abc', 3: 'def', 4: 'ghi', 5: 'jkl', 6: 'mno', 7: 'pqrs'...
Javascript V8
2021-10-24
5
691
题解 | #提取不重复的整数#
let line = readline(); let arr = line.split('').reverse().map(x => parseInt(x)); //Set有去重功能 let list = Array.from(new Set(arr)); print(list.join(''...
Javascript V8
2021-10-24
7
661
题解 | #合并表记录#
let arr = [] while(line = readline()) { arr.push(line); } const length = arr[0]; let list = arr.slice(1, length + 1); let newArr = []; for (ite...
Javascript V8
2021-10-24
6
538
题解 | #走方格的方案数#
while(line = readline()) { const arr = line.split(' ').map(item => parseInt(item)); const [n, m] = arr; //这里很坑,fill的参数千万不能直接给array,引用类型修改...
Javascript V8
2021-10-24
1
480
题解 | #记负均正#
let arr = [] while(line = readline()) { arr.push(line); } let newArr = []; newArr.push(arr.slice(0, 2)); newArr.push(arr.slice(2)); for (let ite...
Javascript V8
2021-10-24
0
488
题解 | #等差数列#
// 利用等差数列前n项和公式 n(a1+aN)/2 while(line = readline()) { const num = parseInt(line); print(num * (2 + 2 + 3*(num -1)) / 2); }
Javascript V8
2021-10-24
2
691
题解 | #等差数列#
while(line = readline()) { const num = parseInt(line); let total = 0; for (let i = 2; i <= 2 + 3*(num-1); i = i+3) { total += i...
Javascript V8
2021-10-24
0
384
题解 | #求最大连续bit数#
while(line = readline()) { const radix2 = parseInt(line).toString(2); let subArr = []; for (let i = 0; i <= radix2.length; i++) { ...
Javascript V8
2021-10-24
0
494
题解 | #统计大写字母个数#
while(line = readline()) { let reg = new RegExp('[A-Z]', 'g') const result = line.match(reg) ? line.match(reg).length : 0; console.log(res...
Javascript V8
2021-10-21
4
464
题解 | #二维数组操作#
let list = [] let error = '数据表超限'; while(line = readline()) { list.push(line); } let newArr = []; newArr.push(list.slice(0 , 5)); newArr.push(lis...
Javascript V8
2021-10-21
2
602
首页
上一页
1
2
3
4
5
下一页
末页