Skip to content

Commit

Permalink
#18 23.02.11 > 4 > 한수 다시 풀기
Browse files Browse the repository at this point in the history
  • Loading branch information
beurmuz committed Feb 11, 2023
1 parent 65b268d commit ca82584
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bj/silver/4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
| 23 | 10866 | [](./10866.js) | 23.01.04 | O |
| 24 | 11047 | [동전0](./11047.js) | 23.01.13 | O | [23.01.16](./replay/11047.js) |
| 25 | 17219 | [비밀번호 찾기](./17219.js) | 23.01.24 | O |
| 26 | 1065 | [한수](./1065.js) | 23.02.09 | X |
| 26 | 1065 | [한수](./1065.js) | 23.02.09 | X | [23.02.11](./replay/1065.js) |
20 changes: 20 additions & 0 deletions src/bj/silver/4/replay/1065.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use strict";

const n = require("fs").readFileSync("/dev/stdin").toString();
const solution = (n) => {
let answer = 0;
for (let i = 1; i <= n; i++) {
if (i < 100) {
answer++;
continue;
}
let nStr = i + "";
let a = +nStr[0] - +nStr[1];
let b = +nStr[1] - +nStr[2];

if (a === b) answer++;
}
return answer;
};

console.log(solution(+n));

0 comments on commit ca82584

Please sign in to comment.