#P15945. [JOI Final 2026] 雨落三角 / Triangular Rainfall
[JOI Final 2026] 雨落三角 / Triangular Rainfall
Problem Description
The country of JOI is an equilateral triangle with side length whose vertices are points , and . Here, is a positive integer. Side connects vertices and in the east-west direction, and vertex is the westernmost point of the country of JOI, while vertex is the easternmost point. Vertex is the northernmost point of the country of JOI.
The country of JOI is divided into regions, each of which is an equilateral triangle with side length . A point that is a vertex of some region is called a lattice point. For integers satisfying and , the lattice point that is the -st from the south and the -st from the west is denoted by . In particular, , and are denoted by , and , respectively. For example, the following figure shows the regions and the lattice points when .
::::aligned{center}
::::
In the country of JOI, weather forecasts for the next days have been announced. On day , rain is forecast to fall in the triangular region whose vertices are lattice points , and . An region is said to be forecast to receive rain on day if the entire region is contained in .
In order to prepare for disasters caused by rainfall, it is necessary to determine, for each , the number of regions that are forecast to receive rain on at least days.
Given the size of the country of JOI, the weather forecasts, and , write a program which, for each , computes the number of regions that are forecast to receive rain on at least days.
Input Format
Input is given from Standard Input in the following format:
Output Format
Print lines to Standard Output. The -th line () should contain the number of regions that are forecast to receive rain on at least days.
5 2 2
1 0 3
0 1 4
21
4
5 4 5
1 0 4
0 1 3
2 0 2
1 2 2
21
10
2
0
0
Hint
Sample 1
If we illustrate, for each region, the number of days on which rain is forecast to fall, we obtain the following figure.
::::aligned{center}
::::
This sample input satisfies the constraints for Subtasks , , , , , and .
Sample 2
If we illustrate, for each region, the number of days on which rain is forecast to fall, we obtain the following figure.
::::aligned{center}
::::
This sample input satisfies the constraints for Subtasks , , , and .
Constraints
- .
- .
- .
- ().
- ().
- ().
- ().
- All input values are integers.
Subtasks
- (4 points) , .
- (5 points) , .
- (5 points) .
- (7 points) .
- (10 points) , .
- (10 points) .
- (23 points) .
- (18 points) .
- (18 points) There are no additional constraints.