Elavenil has a chessboard with N rows and M columns. In one step, he can choose two cells of the chessboard which share a common edge (that has not been cut yet) and cut this edge.
Formally, the chessboard is split into two or more pieces if it is possible to partition its cells into two non-empty subsets S1 and S2 (S1∩S2=∅, |S1|+|S2|=NM) such that there is no pair of cells c1,c2 (c1∈S1,c2∈S2) which share a common edge that has not been cut.
Elavenil does not want the board to split into two or more pieces. Compute the maximum number of steps he can perform while satisfying this condition.
Input:
The only line of input contains two integers N and M.
Output:
Print an integer representing the maximum possible number of steps.
#include <stdio.h> int main() { int n,m; scanf("%d %d",&m,&n); printf("%d",(m-1)*(n-1)); return 0; }
INPUT_1:
Rows and Columns: 7 4
OUTPUT:
Maximum Number of steps: 18
INPUT_2:
Rows and Columns: 6 2
OUTPUT:
Maximum Number of steps: 5
INPUT_3:
Rows and Columns: 4 3
OUTPUT:
Maximum Number of steps: 6
INPUT_4:
Rows and Columns: 10 9
OUTPUT:
Maximum Number of steps: 72
ILLUSTRATION
Morae Q!
- Convert seconds to hours – HMS format.
- Find out the tax amount of the bill with tip for the meal.
- Find the area of the pyramid.
- Find the area of triangle using heron’s formula.
- Find the interest and amount resided in the bank.
- Convert the travel days to years and months.
- Find the first three powers of N number.
- Compute the height from feet and inches to centimetres.
- Calculate the amount of interest earned in the bank.
- Find the ways they can choose the sequence of dummy statues.
- Find the Lapindrome strings.
- Classify the salary of a person.
- Find the day on providing the week number.
- Find the least number of marble stones needed to pave the square mall.
- Find the number of steps on chessboard performed to satisfy a condition.
- Find the time, hours and minutes the train was delayed.
- Find the quantity of food packets shared and available.
- Compute all Arithmetic Operations.
- Find the amount to pay for the electricity bill.
- Find the sum of numbers with three values after decimal point.