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

33270번 - Conditions 다국어

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

문제

You are given a list $a$ that contains $n$ different positive integers, a positive integer $k,ドル and a positive integer~$\ell$. Find the smallest integer $x$ that is greater than or equal to $\ell$ and satisfies exactly one condition among the following ones:

  • $x$ is in the list $a$;
  • $x$ is not divisible by $k$;
  • $x$ contains 7ドル$ in its decimal representation.

입력

The first line contains two integers $n$ and $k$ (1ドル \le n \le 10^5,ドル 2ドル \le k \le 10^5$).

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ (1ドル \le a_i \le 10^{18}$).

The third line contains a single integer $\ell$ (1ドル \le \ell \le 10^{18}$).

출력

Output a single integer, the answer to the problem.

제한

예제 입력 1

5 9
181 182 184 178 81
173

예제 출력 1

183

예제 입력 2

1 888
888
888

예제 출력 2

888

노트

In the sample, the integers 173,174,175,176,177,179,181,182ドル$ satisfy two conditions. The integer 178ドル$ satisfies three conditions. The integer 180ドル$ does not fulfill any conditions. Finally, the integer 183ドル$ satisfies exactly one condition: it is not divisible by 9ドル$.

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 4: Danil Zashikhin && Atilla Gün Contest, supported by Pinely B번

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

출처

대학교 대회

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

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