CF215C.Crosses

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is a board with a grid consisting of nn rows and mm columns, the rows are numbered from 11 from top to bottom and the columns are numbered from 11 from left to right. In this grid we will denote the cell that lies on row number ii and column number jj as (i,j)(i,j) .

A group of six numbers (a,b,c,d,x0,y0)(a,b,c,d,x_{0},y_{0}) , where 0<=a,b,c,d0<=a,b,c,d , is a cross, and there is a set of cells that are assigned to it. Cell (x,y)(x,y) belongs to this set if at least one of two conditions are fulfilled:

  • x0x<=a|x_{0}-x|<=a and y0y<=b|y_{0}-y|<=b
  • x0x<=c|x_{0}-x|<=c and y0y<=d|y_{0}-y|<=d

The picture shows the cross (0,1,1,0,2,3)(0,1,1,0,2,3) on the grid 3×43×4 . Your task is to find the number of different groups of six numbers, (a,b,c,d,x0,y0)(a,b,c,d,x_{0},y_{0}) that determine the crosses of an area equal to ss , 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)(x,y) of the cross 1<=x<=n; 1<=y<=m1<=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.

输入格式

The input consists of a single line containing three integers nn , mm and ss ( 1<=n,m<=5001<=n,m<=500 , 1<=s<=nm1<=s<=n·m ). The integers are separated by a space.

输出格式

Print a single integer — the number of distinct groups of six integers that denote crosses with area ss and that are fully placed on the n×mn×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.

输入输出样例

  • 输入#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,1) , (0,0,0,0,1,2)(0,0,0,0,1,2) , (0,0,0,0,2,1)(0,0,0,0,2,1) , (0,0,0,0,2,2)(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,2) , (0,1,1,0,2,3)(0,1,1,0,2,3) , (1,0,0,1,2,2)(1,0,0,1,2,2) , (1,0,0,1,2,3)(1,0,0,1,2,3) .

首页