[Solution] Accumulation of Dominoes Codeforces Solution
Pak Chanek has a grid that has rows and columns. Each row is numbered from to from top to bottom. Each column is numbered from to from left to right.
Each tile in the grid contains a number. The numbers are arranged as follows:
- Row contains integers from to from left to right.
- Row contains integers from to from left to right.
- Row contains integers from to from left to right.
- And so on until row .
A domino is defined as two different tiles in the grid that touch by their sides. A domino is said to be tight if and only if the two numbers in the domino have a difference of exactly . Count the number of distinct tight dominoes in the grid.
Two dominoes are said to be distinct if and only if there exists at least one tile that is in one domino, but not in the other.
The only line contains two integers and () — the number of rows and columns in the grid.
An integer representing the number of distinct tight dominoes in the grid.
No comments:
Post a Comment