Sicily 1692. Cover Constraints
来源:互联网 发布:千兆网络测速工具 编辑:程序博客网 时间:2024/06/10 17:44
Time Limit: 1 secs, Memory Limit: 32 MB
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
~(~ ̄▽ ̄)~ 想一想L 能构成的最小矩形是什么样的。Just do it!
#include <iostream>using namespace std;int main(){ int n, m; while (cin >> n >> m && (n != 0 || m != 0)) { if ((m * n) % 8 == 0 && (n != 1) && (m != 1)) // Think about it! cout << "YES" << endl; else cout << "NO" << endl; } return 0;}
- Sicily 1692. Cover Constraints
- Sicily 1692 Cover
- 1692. Cover
- 1692.cover
- CONSTRAINTS
- constraints
- Constraints
- Cover
- cover
- cover
- cover
- cover
- cover
- cover
- cover
- Cover
- ORACLE CONSTRAINTS
- Constraints約束條件
- Fragment的使用
- android 连按两次退出程序
- 经验之谈—正则表达式实现图文混排
- 日志 c/c++ 正则表达式 regex
- C++中cout输出字符型指针地址值的方法 http://www.cnblogs.com/wxxweb/archive/2011/05/20/2052256.html
- Sicily 1692. Cover Constraints
- bzoj3514 GERALD07
- android骚年的年终总结和规划
- Android ProgressBar 样式【大全】
- sequence training
- eclipse版本
- Android中图片剪裁时如何预防oom
- android Button源码分析
- JavaMail邮件传输