목록일반수학1 (7)
언젠가는 펼쳐 볼 아카이브
사용언어 : javascript - node.js #제출코드 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const input = fs.readFileSync(filePath).toString().trim().split('\n'); const testCase = +input.shift(); let testArr = input.map((item) => +item); solution(testCase, testArr); function solution(testCase, testArr) { const coins = [25, 10, 5, 1]; testArr.forEach(..

사용언어 : javascript - node.js #제출코드 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const [num, radix] = fs.readFileSync(filePath).toString().trim().split(' '); solution(+num, +radix); function solution(num, radix) { console.log(num.toString(radix).toUpperCase()); } >> 진법 변환 1 문제와 동일하게 풀음. 참고 : https://developer.mozilla.org/en-US/docs/Web/Jav..

사용언어 : javascript - node.js #제출코드 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const [b, radix] = fs.readFileSync(filePath).toString().trim().split(' '); solution(b, radix); function solution(b, n) { console.log(parseInt(b, n)); } * pow 함수를 이용하기 위해 MDN 페이지에서 찾고, 진법 관련해서 찾아보던 중, parseInt 함수의 인자값이 2개라는것을 알게 되었다. - parseInt 함수의 첫번째 인자 값은 st..