Statistics

Problem Statement for "PaintingCells"

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

  4. 10

    10

    Returns: 50

  5. 20

    20

    Returns: 200

  6. 30

    50

    Returns: 750

  7. 100

    100

    Returns: 5000

  8. 28

    47

    Returns: 658

  9. 34

    35

    Returns: 595

  10. 99

    99

    Returns: 4901

  11. 1

    100

    Returns: 50

  12. 99

    1

    Returns: 50

  13. 100

    1

    Returns: 50

  14. 56

    78

    Returns: 2184

  15. 93

    94

    Returns: 4371

  16. 4

    8

    Returns: 16

  17. 8

    15

    Returns: 60

  18. 15

    23

    Returns: 173

  19. 1

    3

    Returns: 2

  20. 5

    5

    Returns: 13

  21. 7

    4

    Returns: 14

  22. 2

    1

    Returns: 1

  23. 100

    25

    Returns: 1250

  24. 2

    2

    Returns: 2

  25. 99

    87

    Returns: 4307

  26. 5

    1

    Returns: 3

  27. 6

    5

    Returns: 15


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: