본문 바로가기
SMALL

BOJ4

백준 Node.js(자바스크립트) 11328 strfry문제 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const input = fs.readFileSync(filePath).toString().split("\n"); let num = +input.shift(); strfry(); function strfry() { for (let i = 0; i < num; i++) { let arr = input[i].split(" "); let a = arr[0]; let b = arr[1].split("").reverse().join(""); if (a === b) { console.log("Possible"); } else { c.. 2021. 9. 23.
백준 Node.js(자바스크립트) 10808번 알파벳 개수(아스키코드) const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const input = fs.readFileSync(filePath).toString().split(""); alphabet(input); function alphabet(A) { let arr = Array(26).fill(0); for (let i = 0; i < A.length; i++) { let letter = A[i].charCodeAt() - 97; arr[letter]++; } console.log(arr.join(" ")); } 아스키코드 대처법과 빈배열만들기(Array().fill())을 알면 어렵지않다. 2021. 9. 22.
백준 Node.js(자바스크립트) 1267번 핸드폰 요금 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const input = fs.readFileSync(filePath).toString().split("\n"); let call = input.shift(); let calls = input[0].split(" ").map(a => Number(a)); callBill(calls); function callBill(B) { let m = 0; let y = 0; for (let i = 0; i < B.length; i++) { y += B[i] % 30 === 0 ? (B[i] / 30 + 1) * 10 : Math.c.. 2021. 9. 21.
백준 Node.js(자바스크립트) 1011문제 Fly me to the Alpha Centauri const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString().split('\n'); let testCase = input[0]; solution(); function solution() { for (let i = 1; i > √n이 자연수일 경우에는 √n + √n-1을 하면 됨 else >> √n이 딱 떨어지지않을경우 n의제곱 ~ (n+1)의 제곱 사이에 있는 건데 아무 수나 넣고 적어보니 √n를 2곱하고 소수점을 뺐다. 2021. 9. 10.
LIST