TopcoderARCHIVE
Archive/Problems/PaintingCells
SRM · Problem 13375

PaintingCells

Problem statement, definition, constraints, and public examples.

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
    1
    Returns: 1
    The only cell in the board is white
  2. 3
    2
    Returns: 3
    There are three white cells and three black cells as follows: WB BW WB
  3. 7
    13
    Returns: 46
← All problems