CF215C.Crosses
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a board with a grid consisting of n rows and m columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the cell that lies on row number i and column number j as (i, j).
A group of six numbers (a, b, c, d, _x_0, _y_0), where 0 ≤ a, b, c, d, is a cross, and there is a set of cells that are assigned to it. Cell (x, y) belongs to this set if at least one of two conditions are fulfilled:
- |_x_0 - x| ≤ a and |_y_0 - y| ≤ b
- |_x_0 - x| ≤ c and |_y_0 - y| ≤ d
The picture shows the cross (0, 1, 1, 0, 2, 3) on the grid 3 × 4.
Your task is to find the number of different groups of six numbers, (a, b, c, d, _x_0, _y_0) that determine the crosses of an area equal to s, which are placed entirely on the grid. The cross is placed entirely on the grid, if any of its cells is in the range of the grid (that is for each cell (x, y) of the cross 1 ≤ x ≤ n; 1 ≤ y ≤ m holds). The area of the cross is the number of cells it has.
Note that two crosses are considered distinct if the ordered groups of six numbers that denote them are distinct, even if these crosses coincide as sets of points.
有一个由 n 行 m 列组成的网格棋盘,行号从上到下依次为 1 到 n,列号从左到右依次为 1 到 m。在该网格中,我们将位于第 i 行、第 j 列的格子记作 (i,j)。
六元组 (a,b,c,d,x0,y0)(其中 0≤a,b,c,d)定义了一个“十字形”,并对应一个格子集合。格子 (x,y) 属于该集合,当且仅当以下两个条件中至少有一个成立:
- ∣x0−x∣≤a 且 ∣y0−y∣≤b
- ∣x0−x∣≤c 且 ∣y0−y∣≤d
图中展示了网格 3×4 上的十字形 (0,1,1,0,2,3)。
你的任务是:求出所有满足以下条件的互不相同的六元组 (a,b,c,d,x0,y0) 的个数:其定义的十字形面积恰好为 s,且整个十字形完全落在该网格内。所谓“完全落在网格内”,是指该十字形的所有格子 (x,y) 均满足 1≤x≤n 且 1≤y≤m。十字形的面积即为其所含格子的总数。
注意:若两个十字形对应的六元组(按顺序)不同,则即使它们作为格子集合完全相同,也被视为不同的十字形。
输入格式
The input consists of a single line containing three integers n, m and s (1 ≤ n, m ≤ 500, 1 ≤ s ≤ n·m). The integers are separated by a space.
输入包含一行,其中为三个整数 n、m 和 s(1 ≤ n, m ≤ 500,1 ≤ s ≤ n⋅m),整数之间用空格分隔。
输出格式
Print a single integer — the number of distinct groups of six integers that denote crosses with area s and that are fully placed on the n × m grid.
Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
输出一个整数——表示在 n×m 网格上完全放置的、面积为 s 的十字形图案所对应的互不相同的六元整数组的个数。
请注意,在 C++ 中读写 64 位整数时,请勿使用 %lld 说明符。推荐使用 cin / cout 流,或 %I64d 说明符。
输入输出样例
输入#1
2 2 1
输出#1
4
输入#2
3 4 5
输出#2
4
说明/提示
In the first sample the sought groups of six numbers are: (0, 0, 0, 0, 1, 1), (0, 0, 0, 0, 1, 2), (0, 0, 0, 0, 2, 1), (0, 0, 0, 0, 2, 2).
In the second sample the sought groups of six numbers are: (0, 1, 1, 0, 2, 2), (0, 1, 1, 0, 2, 3), (1, 0, 0, 1, 2, 2), (1, 0, 0, 1, 2, 3).
在第一个样例中,所求的六元组为:(0,0,0,0,1,1)、(0,0,0,0,1,2)、(0,0,0,0,2,1)、(0,0,0,0,2,2)。
在第二个样例中,所求的六元组为:(0,1,1,0,2,2)、(0,1,1,0,2,3)、(1,0,0,1,2,2)、(1,0,0,1,2,3)。
输入解题思路,AI测评打分。不知道怎么写?