#CCBCHBA0000117. Đếm ô có tổng chẵn (Count Even-Sum Cells)
Đếm ô có tổng chẵn (Count Even-Sum Cells)
Count Even-Sum Cells
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given , count pairs such that , and is even. Each pair represents one distinct cell.
Input
One line contains .
Output
Print the count of valid pairs.
Subtasks
-
Subtask 1 (20%): .
-
Subtask 2 (30%): .
-
Subtask 3 (50%): .
Examples
Example 1
Input:
3 3
Output:
5
Explanation:
The 3×3 grid has 5 even-sum cells, including the top-left cell.
Example 2
Input:
1 2
Output:
1
Explanation:
The 1×2 grid has 1 even-sum cells, including the top-left cell.