#P6222. 「P6156 简单题」加强版

「P6156 简单题」加强版

Description

There are TT queries. At the beginning, you are given a constant KK. In each query, you are given nn separately. Please compute:

$$\sum_{i=1}^{n}\sum_{j=1}^{n} (i+j)^K \gcd(i,j) \mu^2(\gcd(i,j)) \pmod {2^{32}}$$

Input Format

The first line contains three positive integers T,N,KT, N, K, representing the number of queries, the maximum value of NN among the queries, and the given constant.

In the next TT lines, each line contains one positive integer, representing the value of nn for that query.

Output Format

Output TT lines. Each line contains one non-negative integer, representing the result of evaluating the expression in the statement for the given nn.

4 1919 5
1
14
51
4

32
1012884514
62017882
105160

Hint

There are 55 groups of testdata. Group ii satisfies: N=10i+2N=10^{i+2}.

For all testdata, it holds that: T=104T = 10^4, 1K<2311 \leq K < 2^{31}.

Translated by ChatGPT 5