20250601 baekjoon javascript
This commit is contained in:
parent
af758ceb0f
commit
ebe2262463
9
code_study/Baekjoon/js/10988.js
Normal file
9
code_study/Baekjoon/js/10988.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const s = require("fs").readFileSync(0, "utf8").toString().trim();
|
||||||
|
let flag = 1;
|
||||||
|
for(let i=0; i<s.length/2; i++){
|
||||||
|
if(s[i]!=s[s.length-i-1]){
|
||||||
|
flag = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(flag);
|
||||||
17
code_study/Baekjoon/js/1157.js
Normal file
17
code_study/Baekjoon/js/1157.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const n = require("fs").readFileSync(0,"utf8").toString().toUpperCase();
|
||||||
|
let arr = new Array(26).fill(0);
|
||||||
|
|
||||||
|
for(let c of n){
|
||||||
|
arr[c.charCodeAt()-'A'.charCodeAt()]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
let max_idx = 0, cnt = 0;
|
||||||
|
|
||||||
|
for(let i=0; i<26; i++){
|
||||||
|
if(arr[i]==Math.max(...arr)){
|
||||||
|
max_idx=i;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(cnt>1 ? '?' : String.fromCharCode('A'.charCodeAt()+max_idx));
|
||||||
7
code_study/Baekjoon/js/2444.js
Normal file
7
code_study/Baekjoon/js/2444.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
const n = Number(require("fs").readFileSync(0, "utf8").toString());
|
||||||
|
for(let i=1; i<=n; i++){
|
||||||
|
console.log(' '.repeat(n-i) + '*'.repeat(2*i-1));
|
||||||
|
}
|
||||||
|
for(let i=n-1; i>0; i--){
|
||||||
|
console.log(' '.repeat(n-i) + '*'.repeat(2*i-1));
|
||||||
|
}
|
||||||
3
code_study/Baekjoon/js/25083.js
Normal file
3
code_study/Baekjoon/js/25083.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
console.log(
|
||||||
|
" ,r'\"7\nr`-_ ,' ,/\n \\. \". L_r'\n `~\\/\n |\n |"
|
||||||
|
);
|
||||||
3
code_study/Baekjoon/js/3003.js
Normal file
3
code_study/Baekjoon/js/3003.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const n = require("fs").readFileSync(0,'utf8').toString().split(" ").map(Number);
|
||||||
|
const arr = [1,1,2,2,2,8];
|
||||||
|
console.log(...arr.map((v,i)=>v-n[i]));
|
||||||
Loading…
x
Reference in New Issue
Block a user