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

19284번 - Oneness 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB302210.526%

문제

Define oneness of the number $x$ to be a number of integers $d > 1$ dividing $x,ドル whose decimal representation consists only of digit 1ドル$. For example, $oneness(121) = 1$ and $oneness(1221) = 2$.

Number $n$ is obtained using the following algorithm involving a pseudo-random number generator. You are given two integers $l$ and $s_0,ドル which are the length of the decimal representation of $n$ and the generator seed.

The digits $d_0d_1 \ldots d_{l-1}$ of the number $n$ are generated by the following recursions:

$$ d_i = \left\lfloor s_i / 1024 \right\rfloor \mod 10 \\ s_{i + 1} = (747796405 s_i - 1403630843) \mod 2^{32} $$

It is guaranteed that $d_0$ is non-zero.

Calculate the total oneness over all integers between 1ドル$ and $n$.

입력

The first line contains two integers $l,ドル $s$ (1ドル\le l \le 250,000円,ドル 0ドル \leq s_0 < 2^{32}$), the number of digits in the decimal representation of $n$ and the seed of pseudo-random number generator that is used to create the decimal representation of $n$.

출력

Output the sum of oneness over all integers between 1ドル$ and $n$.

제한

예제 입력 1

1 1024

예제 출력 1

0

예제 입력 2

2 1048

예제 출력 2

1

예제 입력 3

4 11312

예제 출력 3

123

예제 입력 4

4 31415926

예제 출력 4

942

힌트

In sample tests $n$ equals 1, 11, 1221 and 9359 respectively.

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 4: Yandex Cup 2018 E번

Contest > Open Cup > 2017/2018 Season > Stage 11: Grand Prix of Khamovniki E번

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

출처

대학교 대회

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

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