QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 512 MB Total points: 100

#12385. 小 L 的计算题

统计

现有一个长度为 $n$ $(1 \le n\le 2\times 10^5)$ 的非负整数数组 $\{a_i\}$。小 L 定义了一种神奇变换:

$$ f_k=\sum_{i=1}^{n}a_i^k\pmod{ 998244353 } $$

小 L 计划用变换生成的序列 $f$ 做一些有趣的事情,但是他并不擅长算乘法,所以来找你帮忙,希望你能帮他尽快计算出 $f_1\sim f_n$。

输入格式

输入包含多组数据。

输入的第一行包含一个整数 $T$ $(1\le T\le 20)$, 表示数据组数。

接下来 $2T$ 行,每两行代表一组测试数据。

每组数据的第一行包含一个整数 $n$,表示数组 $\{a_i\}$ 的长度。接下来一行 $n$ 个整数,描述数组 $\{a_i\}$。

保证输入的 $a_i$ 满足 $0\le a_i\le 10^9$。在一个测试文件中,保证有 $\sum n\le 4\times 10^5$。

输出格式

我们不想让你输出过多的数。因此,令 $\text{ans}=f_1\oplus f_2\oplus\dots\oplus f_n$,其中 $\oplus$ 表示异或操作,在 C++ / Java / Python 中,它可以表示为 ^

对每组数据,你需要输出一行一个整数,表示 $\text{ans}$。

样例数据

样例 1 输入

2
3
2 3 3
5
1 2 3 4 5

样例 1 输出

32
4675
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.