티스토리 뷰

https://www.acmicpc.net/problem/1475

 

1475번: 방 번호

첫째 줄에 다솜이의 방 번호 N이 주어진다. N은 1,000,000보다 작거나 같은 자연수이다.

www.acmicpc.net

const fs = require('fs');
let input = +fs.readFileSync('./dev/stdin').toString().trim();

let num = Array(10).fill(0);

while (input > 0) {
	num[input % 10]++;
	input = Math.floor(input / 10);
}
num[9] = Math.ceil((num[6] + num[9]) / 2);
num[6] = 0;
console.log(Math.max(...num));
728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함