Problem A
Attacker
Input: Standard Input
Output: Standard Output
There
are k attackers in an n * m chessboard.
The
i-th attacker is located in (Xi, Yi),
with a attacking range of Ri.
A
square (X, Y) is attacked by the i-th attacker if and
only if |X - Xi|
+ |Y - Yi| <= Ri.
Count
the number of squares on the chessboard attacked by at least one attacker.
Input
There are several input cases. The first line contains three integers n, m, k (1 ≤ n,m ≤ 100000000, 1 ≤ k ≤ 20000). In the following k lines, each line contains three integers Xi, Yi, Ri (1 ≤ Xi ≤ n, 1≤ Yi ≤ m, 1 ≤ Ri ≤1000000), the position and attack range of each attacker.
The last case is followed by
a single zero, which should not be processed.
Output
For each case, print the case number and the answer.
Sample
Input |
Sample
Output |
4 4 3 1 1 1 3 1 1 3 3 1 1 10 1 1 1 1 0 |
Case 1:
10 Case 2: 2 |
Problemsetter: Chen Qifeng
Supplied by: Rujia Liu