牛客971465536号
牛客971465536号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客971465536号的博客
全部文章
/ 题解
(共32篇)
题解 | #字符串加密#
//先去重获得秘钥然后进行二次去重获取字典,使用asc码差值获取字母位置 while(key = readline()) { const newStr = Array.from(new Set(key.split(''))).join('').toLowerCase(); cons...
Javascript V8
2021-10-25
0
443
题解 | #字符串排序#
while(line = readline()) { let length = line.length; let pointer = 97; let codeArr = []; let otherArr = []; for (let i = 0; i <...
Javascript V8
2021-10-25
0
554
题解 | #简单密码#
//总感觉这么列出来有点傻 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
539
题解 | #走方格的方案数#
while(line = readline()) { const arr = line.split(' ').map(item => parseInt(item)); const [n, m] = arr; //这里很坑,fill的参数千万不能直接给array,引用类型修改...
Javascript V8
2021-10-24
1
482
题解 | #记负均正#
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
489
题解 | #等差数列#
// 利用等差数列前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
692
题解 | #等差数列#
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
385
题解 | #求最大连续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
495
首页
上一页
1
2
3
4
下一页
末页