#P15802. [GESP202603 七级] 拆分
[GESP202603 七级] 拆分
Background
Related multiple-choice and true/false problems: https://ti.luogu.com.cn/problemset/1211.
Problem Description
Xiao A wants to split a positive integer into the sum of several positive integers, and maximize the product of the integers after splitting. Xiao A hopes you can help him compute the maximum possible product. Since the answer may be very large, you only need to output the result modulo .
Formally, a split of is a set of positive integers such that , where . You need to output, among all splits of , the maximum value of modulo .
Input Format
The first line contains a positive integer , the number of test cases.
For each test case: one line containing an integer , the given positive integer.
Output Format
For each test case: output one line containing an integer, the maximum product after splitting modulo .
3
5
8
100
6
18
755407364
Hint
For of the test cases, it is guaranteed that .
For all test cases, it is guaranteed that and .
Translated by ChatGPT 5