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

7408번 - Amusing Numbers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB188535.714%

문제

Let us consider the set of integer numbers between 1 and N inclusive. Let us order them lexicographically (i. e. like in the vocabulary), for example, for N = 11 the order would be: 1, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9.

Let us denote the position of the number K in this ordering as QN,K. For example, Q11,2 = 4. Given numbers K and M find the smallest N such that QN,K = M.

입력

Input contains two integer numbers K and M (1 ≤ K, M ≤ 109) separated by a space.

출력

If such N that QN,K = M exists then write to the output file the smallest such N, otherwise write 0.

제한

예제 입력 1

2 4

예제 출력 1

11

예제 입력 2

2 1

예제 출력 2

0

예제 입력 3

100000001 1000000000

예제 출력 3

100000000888888879

예제 입력 4

1000000000 11

예제 출력 4

0

힌트

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > NEERC 2002 A번

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

출처

대학교 대회

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

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