Logo
(追記) (追記ここまで)

27188번 - The Length of the Sequence 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB71141225.000%

문제

Consider the segment of non-negative integers from $l$ to $r$. Write them in a row in decimal notation, getting a string $a$. For example, if $l=3$ and $r=10,ドル $a=345678910$.

You have to find such segment of consecutive non-negative integers $[l,r]$ (0ドル \le l \le r \le 10^{18}$) that the length of the string $a,ドル corresponding to this segment, is exactly $S,ドル and the number of integers in the segment $[l,r]$ is maximum possible.

입력

The only line contains one integer $S$ (1ドル \le S \le 10^{18}$).

출력

Print the length of the optimal segment $[l,r]$ in the first line. If there is no solution, print $-1$.

If the solution exists, print two integers $l$ and $r$ in the second line.

If there are multiple optimal solutions, print any of them.

제한

예제 입력 1

3

예제 출력 1

3
0 2

예제 입력 2

10

예제 출력 2

10
0 9

예제 입력 3

20

예제 출력 3

15
0 14

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2022 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /