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

31157번 - Primes and XOR? Nonsense 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB222100.000%

문제

Define $\mathbb{P}_{LR} = \mathbb{P} \cap [L;R],ドル where $\mathbb{P}$ is the set of prime numbers. In other words, $\mathbb{P}_{LR}$ is the set of all primes between $L$ and $R$ inclusive.

Given $L$ and $R,ドル find the number of integers that can be represented as XOR of some (possibly empty) subset of $\mathbb{P}_{LR}$.

입력

The first line of input contains one integer $T$ (1ドル \le T \le 100$) --- the number of independent test cases you need to process. Descriptions of $T$ test cases follow.

The description of one test case consists of two integers $L$ and $R$ (2ドル \le L \le R \le 10^{12}$).

출력

For each test case print the answer on a separate line.

제한

예제 입력 1

3
2 10
999999940 1000000000
2 1000000000000

예제 출력 1

8
1
1099511627776

노트

In the first example, $\mathbb{P}_{LR} = \{ 2, 3, 5, 7 \}$.

  • 0ドル = 2 \oplus 5 \oplus 7$
  • 1ドル = 2 \oplus 3$
  • 2ドル = 2$
  • 3ドル = 3$
  • 4ドル = 3 \oplus 7$
  • 5ドル = 2 \oplus 7$
  • 6ドル = 3 \oplus 5$
  • 7ドル = 7$

In the second example, $\mathbb{P}_{LR} = \varnothing,ドル so only 0ドル$ can be represented as XOR of some subset.

출처

Contest > Open Cup > 2021/2022 Season > Stage 7: Grand Prix of Southeastern Europe L번

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

출처

대학교 대회

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

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