Problems > Black Squares

Black Squares

Difficulty: 900 2000 ms 128 MB

math

An N×M board is colored like a chessboard with the top-left cell BLACK. How many black cells are there?

Input: one line with two integers N and M.

Output: ⌈N·M / 2⌉.

Constraints:

  • 1 ≤ N, M ≤ 109

Sample Tests

Input 1
3 3
Output 1
5
Input 2
2 2
Output 2
2

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.