SMALL
https://www.acmicpc.net/problem/1476
let input = require('fs').readFileSync('/dev/stdin').toString().trim().split(' ').map(e => +e);
let [e, s, m] = [...input];
let count = 1;
while (1) {
if (
(count - e) % 15 === 0 &&
(count - s) % 28 === 0 &&
(count - m) % 19 === 0
) {
console.log(count);
break;
}
count++;
}
코드보다 문제 이해하는게 더 어려운거같은데... 뭐지?
근데 저 코드로 제출하면 메모리초과가 뜬다. 브루트하지않은녀석
https://kscodebase.tistory.com/416
[node.js] 날짜 계산 ( 백준 1476번 )
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { const [E, S, M] = line.split(" ").map(Number);..
kscodebase.tistory.com
저 블로그 보면 입력값을 다르게 처리하면되나..?
LIST
'코테 > 코테withJS' 카테고리의 다른 글
| 유용한 method(배열) (0) | 2022.11.03 |
|---|---|
| 유용한 method(숫자, 문자) (0) | 2022.11.03 |
| 백준 3085번 사탕 게임 자바스크립트 (0) | 2022.07.03 |
| 백준 2309번 일곱 난쟁이 (0) | 2022.07.02 |
| 백준 Node.js(자바스크립트) 11328 strfry문제 (0) | 2021.09.23 |