Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- n, m, max, min, ans1, ans2, ans3, ans : longint;
- begin
- read (n, m);
- if n > m then
- begin
- max := n;
- min := m;
- end
- else
- begin
- max := m;
- min := n;
- end;
- if (n = 1) or (m = 1) then
- begin
- Writeln (0);
- halt;
- end;
- ans1 := max - 1;
- ans1 := ans1 * (min div 2);
- ans2 := ans1;
- if min mod 2 <> 0 then
- ans2 := ans2 + max div 2;
- ans3 := max - 1 + (max div 2) * (min - 2);
- if max mod 2 <> 0 then
- ans3 := ans3 + (max - 2) div 2;
- if ans1 > ans2 then
- ans := ans1 else
- ans := ans2;
- if ans3 > ans then
- ans := ans3;
- Writeln (ans);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement