Logo
(追記) (追記ここまで)

9386번 - Royal Gems 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB226426.667%

문제

In the game of Royal Gems, you are given an n × m board and arbitrarily large number of ruby, emerald, sapphire, and diamond gemstones. You must put one gemstone in each cell of the board according to the following rules:

  1. Every ruby has an emerald, a sapphire and a diamond in his neighbors.
  2. Every emerald has a sapphire and a diamond in her neighbors.
  3. Every sapphire has a diamond in his neighbors.

A neighbor of a cell is one of the four cells that are directly above, below, left, or right of the cells. Write a program that finds the maximum number of ruby gemstones that could be put on the board satisfying the above rules.

입력

There are multiple test cases in the input. Each test case consists of n (1 < n < 8) and m (1 < m < 8). The input terminates with a line containing 0 0.

출력

For each test case, write a single line containing the maximum number of ruby gemstones on the board.

제한

예제 입력 1

2 2
2 3
3 3
0 0

예제 출력 1

0
1
2

힌트

출처

ICPC > Regionals > Asia West Continent > Iran > Tehran Site 2008 J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /