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

30167번 - Distinct Digits 스페셜 저지다국어

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

문제

You have two integers $l$ and $r$. Find an integer $x$ which satisfies the conditions below:

  • $l \le x \le r$.
  • All digits of $x$ are different.

If there are multiple answers, print any of them.

입력

The first line contains two integers $l$ and $r$ (1ドル \le l \le r \le 10^{5}$).

출력

If an answer exists, print any of them. Otherwise, print $-1$.

제한

예제 입력 1

121 130

예제 출력 1

123

예제 입력 2

98766 100000

예제 출력 2

-1

노트

In the first example, 123ドル$ is one of the possible answers. However, 121ドル$ can't be the answer, because there are multiple 1ドル$s on different digits.

In the second example, there is no valid answer.

출처

Contest > Codeforces > Codeforces Round 589 (Div. 2) A번

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

출처

대학교 대회

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

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