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

35016번 - Sums of Two 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB345310.345%

문제

Lina the Magician claims that a common modern computer can easily perform a hundred billion operations per second! To prove it, she proposes to run the following calculations.

Let $V$ be a set of integers, initially empty. We are given the starting value of the integer $s$. Make $n$ steps described below:

  • $s \leftarrow (s \cdot 618,023円 + 1) \bmod 999,983円$;
  • find the number of distinct pairs of integers in $V$ that have the sum $s$;
  • if this number is even, insert $s$ into the set $V$.

How many elements will there be in $V$ after $n$ steps?

Formally: on each step, we count the number of pairs $(a, b)$ where $a \in V,ドル $b \in V,ドル $a \le b$ and $a + b = s$.

입력

The first line contains integers $n$ and $s$ (1ドル \le n \le 200,000円$; 0ドル \le s < 999,983円$; $s \ne 742,681円$).

출력

Print a single integer: the size of set $V$ after $n$ steps.

제한

예제 입력 1

4 179629

예제 출력 1

3

노트

In the example, the values of $s$ on the four steps are 740ドル,740円,ドル 139ドル,655円,ドル 469ドル,353円,ドル and 880ドル,395円$.

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2025-2026 Northwestern Russia Qualification M번

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

출처

대학교 대회

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

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