21688_Cover

2022-5-16 18:20| 发布者: Hocassian| 查看: 31| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505761875600-Problem List-采集的数据-后羿采集器.html

Pro.ID

21688

Title

Cover

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21688

AC

3

Submit

6

Ratio

50.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Tom wants to cover a rectangular floor by identical L-shape tiles without overlap. As shown below, the floor can be split into many small squares, and the L-shape tile consists of exactly four small squares. The floor of 3×8 can be completely covered by 6 L-shape tiles, but the floor of 3×7 is impossible.

    Tom would like to know whether an arbitrary floor with n×m small squares can be completely covered or not. He is sure that when n and m are small he can find the answer by paper work, but when it comes to larger n and m, he has no idea to find the answer. Can you tell him?

    输入

    The input file will consist of several test cases. Each case consists of a single line with two positive integers m and n ( 1 ≤ m ≤ 15, 1 ≤ n ≤ 40 ).

    The input is ended by m=n=0.

    输出

    Description

    Tom wants to cover a rectangular floor by identical L-shape tiles without overlap. As shown below, the floor can be split into many small squares, and the L-shape tile consists of exactly four small squares. The floor of 3×8 can be completely covered by 6 L-shape tiles, but the floor of 3×7 is impossible.

    Tom would like to know whether an arbitrary floor with n×m small squares can be completely covered or not. He is sure that when n and m are small he can find the answer by paper work, but when it comes to larger n and m, he has no idea to find the answer. Can you tell him?

    Input

    The input file will consist of several test cases. Each case consists of a single line with two positive integers m and n ( 1 ≤ m ≤ 15, 1 ≤ n ≤ 40 ).

    The input is ended by m=n=0.

    Output

    For each case, print the word 'YES' in a single line if it is possible to cover the m×n floor, print 'NO' otherwise.

    Sample Input

    3 8
    3 7
    0 0

    Sample Output

    YES
    NO

    Source

    样例输入

    3 8
    3 7
    0 0

    样例输出

    YES
    NO

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部