Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Simple game on a grid
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 1023Accepted: 515

Description

There is an infinite grid and an m*n rectangle of stones on it (1 <= m,n <= 1000). The stones are located in the knots of the grid.

A following game for a single player is being played. One stone can jump over another along a vertical or a horizontal line. A stone which had been overjumped is taken away. The purpose of the game is to minimize number of stones on a grid.

Given a pair of numbers m and n separated with one space in an input file you are to write a program which should determine a minimal number of the stones left on the grid.

Input

Numbers m and n separated by space.

Output

The minimal number of the stones left on the grid.

Sample Input

3 4

Sample Output

2

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator