루미 알고리즘

#1437골드Page Numbering

PO 2017 학교 예선코딩출제 Johan Sannemo영어 원문이 문제가 어렵다면 — 배우는 순서 보기

영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)

Problem

(그림은 원문 저장소에서 볼 수 있습니다)

In a certain book with N pages, the publisher wants to save money by only printing page numbers on the right-hand side, i.e. the odd numbers. Write a program that computes how many digits of each kind are used.

Input

The only line contains the integer N (1 ≤ N ≤ 10^12).

Output

Print a line with 10 integers, the number of digits of each kind. First the number of zeros, then the number of ones, and so on.

Scoring

Your solution will be tested on a set of test groups. To earn points for a group, you must pass all test cases in that group.

GroupPointsConstraints
160N ≤ 10^5
240No additional constraints.

Explanation of Sample 1

The page numbers that are printed are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21 and 23. Thus no zeros are needed, 8 ones, 2 twos, 3 threes, no fours, 2 fives, no sixes, 2 sevens, no eights and 2 nines.

예제

예제 1

입력
23
출력
0 8 2 3 0 2 0 2 0 2

예제 2

입력
306
출력
13 96 65 49 15 46 15 45 15 45

예제 3

입력
82056
출력
12178 25911 17233 25411 17205 25409 17200 25405 13228 20405

출처 표기

출처: Programmeringsolympiaden 2017년 학교 예선 · 원문 페이지 · 이용 조건 CC BY-SA · LaTeX 원문을 화면용 글로 옮겼습니다(수식·표의 모양이 다를 수 있습니다). 내용은 고치지 않았습니다.

크리에이티브 커먼즈 저작자표시-동일조건변경허락.

문제 출처: 한국정보올림피아드(KOI) (CC BY-NC-SA 4.0) · International Olympiad in Informatics (IOI) (CC BY) · Centre for Education in Mathematics and Computing (CEMC), University of Waterloo (CC BY-NC 4.0) · Programmeringsolympiaden (CC BY-SA) · CSES Problem Set (Antti Laaksonen) (CC BY-NC-SA 4.0). 루미 알고리즘은 위 단체들과 관계없는 별도의 서비스이며, 자료는 원문 그대로 싣습니다. 문제마다 출처와 이용 조건을 따로 표기합니다.