Pacific knights

Given an n × m chess board, how many knights can we place on it so that
no two knights threaten each other? For instance, we can place six
knights on a 2 × 5 board:

Input

Input consists of several cases, each with n and m, both between 1 and
10⁴.

Output

For every case, print the maximum number of knights that we can place on
an n × m chess board without any threats.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:33:55.818Z

© Jutge.org, 2006–2026.
https://jutge.org
