You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine a white rectangular grid of `n` rows and `m` columns divided into two parts by a diagonal line running from the upper left to the lower right corner. Now let's paint the grid in two colors according to the following rules:
8
+
```
9
+
A cell is painted black if it has at least one point in common with the diagonal;
10
+
Otherwise, a cell is painted white.
11
+
```
12
+
Count the number of cells painted black.
13
+
14
+
# Example
15
+
16
+
For n = 3 and m = 4, the output should be `6`
17
+
18
+
There are 6 cells that have at least one common point with the diagonal and therefore are painted black.
0 commit comments