QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#3726. 2017 复仇

Statistics

Bobo 有 $n$ 个整数 $a_1, a_2, \dots, a_n$。 他想从中选择一些整数并计算它们的乘积(空集的乘积定义为 $1$)。

Bobo 想知道有多少种乘积对 $2017$ 取模后的余数为 $r$。由于结果可能非常大,他只需要求出该数量模 $2$ 的结果。

输入格式

输入包含零个或多个测试用例,并以文件结束符(EOF)终止。对于每个测试用例:

第一行包含两个整数 $n, r$。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$。

  • $1 \leq n \leq 2\times 10^6$
  • $1 \leq r, a_1, a_2, \dots, a_n < 2017$
  • $n$ 的总和不超过 $2 \times 10^6$。

输出格式

对于每个测试用例,输出一个整数,表示该数量的奇偶性。

样例

样例输入 1

3 6
2 3 4
4 1
1 1 2016 2016

样例输出 1

1
0

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.