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

19001번 - Rikka with XOR 다국어

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

문제

When Rikka was a little girl, she met a hard but interesting problem "A good task to defend AK". This problem used some properties of XOR (exclusive OR, denoted by "$\oplus$" as a binary operation).

Time flies, six years have passed. Rikka has become a college student. Today, Rikka recollected this problem, and she suddenly understood that she knows little about XOR. So she wanted to come up with some problems about XOR and try to solve them.

Most of the problems were very simple, except one of them. Soon, Rikka found it too difficult. So she asked you to give her some help.

Here is the problem. Given two integers $n$ and $m,ドル calculate $\prod\limits_{i = 0}^{m} (n \oplus i)$. The answer may be very large, so just find it modulo 1ドル,500円,000円,001円$ (which is a prime number).

입력

The first line contains a single integer $t$ (1ドル \leq t \leq 20$), the number of test cases.

Each test case is given on a separate line which contains two integers $n$ and $m$ (1ドル \leq m < n \leq 10^9$).

출력

For each test case, print a single integer: the answer modulo 1ドル,500円,000円,001円$.

제한

예제 입력 1

3
3 2
7 5
654321 123456

예제 출력 1

6
5040
1230647278

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 6: Ruyi Ji Contest 4 C번

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

출처

대학교 대회

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

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