#P3923. 大学数学题
大学数学题
Description
Rumia: The Great Fairy wants to construct a finite field of order , where the elements are represented by the integers .
A finite field must satisfy the following conditions:
- There exists an additive identity , such that for any element , .
- For any element , there exists an additive inverse , such that .
- There exists a multiplicative identity different from the additive identity , such that for any element , .
- For any element that is not the additive identity, there exists a multiplicative inverse , such that .
- For any elements , , addition is commutative, i.e., .
- For any elements , , multiplication is commutative, i.e., .
- For any elements , , , addition is associative, i.e., .
- For any elements , , , multiplication is associative, i.e., $( x \times y ) \times z = x \times ( y \times z )$.
- For any elements , , , multiplication distributes over addition, i.e., .
The Great Fairy certainly knows how to do it, but she wants to test you.
In the output, the additive identity is , and the multiplicative identity is .
Description
Input Format
A positive integer ().
Output Format
On the first line, output an integer . If a finite field of order exists, then ; otherwise .
If , then:
- Output an -by- addition table of the finite field in the next lines. The number in row , column represents the result of in the field.
- Output an -by- multiplication table of the finite field in the following lines. The number in row , column represents the result of in the field.
In total, output lines.
upd1: The SPJ is very strict. Do not output extra spaces at the ends of lines (the trailing newline at the end of the file will still be ignored).
upd2: The official correct-answer file is large, so Luogu may keep judging... If this happens, please submit the source code directly.
2
0
0 1
1 0
0 0
0 1
Hint
| Test point | Range of | Special property |
|---|---|---|
| 1 | is prime | |
| 2 | is an integer power of | |
| 3 | None | |
| 4 | is an integer power of | |
| 5 | None | |
| 6 | is prime | |
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | is a square of a prime | |
| 11 | ||
| 12 | ||
| 13 | None | |
| 14 | ||
| 15 | is an integer power of | |
| 16 | None | |
| 17 | ||
| 18 | ||
| 19 | is an integer power of | |
| 20 | None |
Translated by ChatGPT 5
京公网安备 11011102002149号