P27073 [AtCoder] Area Sum
普及
题目描述

Problem Description

There is a board consisting of $ N $ rows and $ M $ columns, and each cell contains an integer from $ 1 $ to $N \times M$ in row-major order. That is, if we denote the integer written in the cell at the $ i $-th row and $ j $-th column as $ A_{i,j} $, then $A_{i,j} = (i-1) \times M + j$.

Count the number of subrectangles in this board whose internal values sum up to exactly $ V $.

More formally, count the number of quadruples of integers $ (a,b,c,d) $ ($1 \leq a \leq b \leq N$, $1 \leq c \leq d \leq M$) such that $\sum_{a \leq i \leq b, c \leq j \leq d} A_{i,j} = V$.

Input Format

The input is given from the standard input in the following format:

$ N $ $ M $ $ V $

Output Format

Output the answer.

Sample Input and Output

Sample Input #1

2 2 3

Sample Output #1

2

Sample Input #2

2 2 5

Sample Output #2

0

Sample Input #3

13 8 1032

Sample Output #3

5

Notes/Hints

Constraints

  • $1 \leq N, M \leq 5000$
  • $1 \leq V \leq 10^{15}$
  • All values in the input are integers.

Sample Explanation 1

The board is filled with integers as follows:

1 2
3 4

The subrectangles that satisfy the condition are $ (a,b,c,d)=(1,1,1,2),(2,2,1,1) $, totaling 2.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2 3
样例输出
2