#P2332. [SCOI2006] 数字立方体
[SCOI2006] 数字立方体
Description
A cube is partitioned into unit cubes, with coordinates denoted by where . Each unit cube contains an integer whose absolute value does not exceed . Count how many subcubes have the sum of all numbers being a multiple of . A subcube is the set of all unit cubes satisfying , , , where .
Input Format
The first line contains two integers , representing the edge length of the cube and the positive integer divisor.
The following lines each contain integers. First come the unit cubes with (i.e., ), then , …, and finally and , for a total of integers.
Output Format
Output a single number: the number of subcubes whose sum of integers is a multiple of .
2 5
1 2
3 4
5 6
7 8
5
Hint
Constraints and Conventions
- of the testdata satisfies .
- of the testdata satisfies .
For all testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号