Problem Statement
You're given the number of rows and columns of a board. You want to paint it black and white like a chess board. You know that the first cell of the first row is white. Calculate and return the number of white cells in the board after you paint it.
Definition
- Class:
- PaintingCells
- Method:
- paint
- Parameters:
- int, int
- Returns:
- int
- Method signature:
- int paint(int rows, int columns)
- (be sure your method is public)
Constraints
- rows and columns will be between 1 and 100 inclusive.
Examples
1
1
Returns: 1
The only cell in the board is white
3
2
Returns: 3
There are three white cells and three black cells as follows: WB BW WB
7
13
Returns: 46
10
10
Returns: 50
20
20
Returns: 200
30
50
Returns: 750
100
100
Returns: 5000
28
47
Returns: 658
34
35
Returns: 595
99
99
Returns: 4901
1
100
Returns: 50
99
1
Returns: 50
100
1
Returns: 50
56
78
Returns: 2184
93
94
Returns: 4371
4
8
Returns: 16
8
15
Returns: 60
15
23
Returns: 173
1
3
Returns: 2
5
5
Returns: 13
7
4
Returns: 14
2
1
Returns: 1
100
25
Returns: 1250
2
2
Returns: 2
99
87
Returns: 4307
5
1
Returns: 3
6
5
Returns: 15