1부터 N까지의 수를 이어서 쓰면 다음과 같이 새로운 하나의 수를 얻을 수 있다.
이렇게 만들어진 새로운 수는 몇 자리 수일까? 이 수의 자릿수를 구하는 프로그램을 작성하시오.
첫째 줄에 N(1 ≤ N ≤ 100,000,000)이 주어진다.
첫째 줄에 새로운 수의 자릿수를 출력한다.
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int result = 0;
int len = 10;
int p = 1;
for (int i = 1; i <= N; i++) {
if (i % len == 0) {
p++;
len *= 10;
}
result += p;
}
System.out.println(result);
}
}