20250524 baekjoon javascript
This commit is contained in:
parent
a1367470a2
commit
cf3feab013
8
code_study/Baekjoon/js/10809.js
Normal file
8
code_study/Baekjoon/js/10809.js
Normal file
@ -0,0 +1,8 @@
|
||||
const s = require("fs").readFileSync(0, "utf8").toString().trim();
|
||||
let arr = new Array(26).fill(-1);
|
||||
for(let i=0; i<s.length; i++){
|
||||
if(arr[s[i].charCodeAt()-97]==-1){
|
||||
arr[s[i].charCodeAt()-97] = i;
|
||||
}
|
||||
}
|
||||
console.log(...arr);
|
||||
2
code_study/Baekjoon/js/1152.js
Normal file
2
code_study/Baekjoon/js/1152.js
Normal file
@ -0,0 +1,2 @@
|
||||
const s = require("fs").readFileSync(0, "utf8").toString().trim().split(" ");
|
||||
console.log(s[0]=="" ? 0 : s.length);
|
||||
1
code_study/Baekjoon/js/11654.js
Normal file
1
code_study/Baekjoon/js/11654.js
Normal file
@ -0,0 +1 @@
|
||||
console.log(require("fs").readFileSync(0, "utf8").toString().trim().charCodeAt());
|
||||
1
code_study/Baekjoon/js/11718.js
Normal file
1
code_study/Baekjoon/js/11718.js
Normal file
@ -0,0 +1 @@
|
||||
console.log(require("fs").readFileSync(0, "utf8").toString().trim());
|
||||
6
code_study/Baekjoon/js/11720.js
Normal file
6
code_study/Baekjoon/js/11720.js
Normal file
@ -0,0 +1,6 @@
|
||||
const n = require("fs").readFileSync(0, "utf8").toString().trim().split("\n");
|
||||
let sum =0;
|
||||
for(let i=0; i<Number(n[0]); i++){
|
||||
sum += Number(n[1][i]);
|
||||
}
|
||||
console.log(sum)
|
||||
9
code_study/Baekjoon/js/2675.js
Normal file
9
code_study/Baekjoon/js/2675.js
Normal file
@ -0,0 +1,9 @@
|
||||
const n = require("fs").readFileSync(0, "utf8").toString().trim().split("\n");
|
||||
for(let i=1; i<=Number(n[0]); i++){
|
||||
let temp = "";
|
||||
[x, s] = n[i].split(" ");
|
||||
for(let ii=0; ii<s.length; ii++){
|
||||
temp += s[ii].repeat(Number(x));
|
||||
}
|
||||
console.log(temp);
|
||||
}
|
||||
1
code_study/Baekjoon/js/2743.js
Normal file
1
code_study/Baekjoon/js/2743.js
Normal file
@ -0,0 +1 @@
|
||||
console.log(require("fs").readFileSync(0, "utf8").toString().trim().length);
|
||||
2
code_study/Baekjoon/js/27866.js
Normal file
2
code_study/Baekjoon/js/27866.js
Normal file
@ -0,0 +1,2 @@
|
||||
const n = require("fs").readFileSync(0, "utf8").toString().split("\n");
|
||||
console.log(n[0][Number(n[1])-1])
|
||||
4
code_study/Baekjoon/js/2908.js
Normal file
4
code_study/Baekjoon/js/2908.js
Normal file
@ -0,0 +1,4 @@
|
||||
const n = require("fs").readFileSync(0, "utf8").toString().split(" ");
|
||||
const a = Number(n[0].split("").reverse().join(""));
|
||||
const b = Number(n[1].split("").reverse().join(""));
|
||||
console.log(a>b?a:b);
|
||||
7
code_study/Baekjoon/js/5622.js
Normal file
7
code_study/Baekjoon/js/5622.js
Normal file
@ -0,0 +1,7 @@
|
||||
const s = require("fs").readFileSync(0, "utf8").toString().trim();
|
||||
const dial = [3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10];
|
||||
let t = 0;
|
||||
for(let i=0; i<s.length;i++){
|
||||
t += dial[s[i].charCodeAt()-65];
|
||||
}
|
||||
console.log(t);
|
||||
5
code_study/Baekjoon/js/9086.js
Normal file
5
code_study/Baekjoon/js/9086.js
Normal file
@ -0,0 +1,5 @@
|
||||
const n = require("fs").readFileSync(0, "utf8").toString().trim().split("\n");
|
||||
for(let i=1; i<=Number(n[0]); i++){
|
||||
s = n[i];
|
||||
console.log("%s%s",s[0],s[s.length-1]);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user