cover
来源:互联网 发布:python 命令行交互 编辑:程序博客网 时间:2024/05/03 12:54
Problem 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.
111
1
11222344
15233364
15556664
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?
111
1
11222344
15233364
15556664
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.
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 83 70 0
Sample Output
YESNO
#include<iostream>#include<cstdio>using namespace std;int main(){//freopen("a.txt","r",stdin);int n,m;while(cin>>n>>m&&n&&m){if(n==1||m==1) printf("NO\n");else{if(m*n%8) printf("NO\n"); else printf("YES\n");}}return 0;}
0 0
- Cover
- cover
- cover
- cover
- cover
- cover
- cover
- cover
- Cover
- 1692. Cover
- cover letter
- cover letter
- Cover Letter
- Comprehensive cover
- hdu5386 Cover
- Cloud Cover
- Vertex Cover
- 1692.cover
- 【纠错记录】有关ASIHTTPRequest异步请求代理Delegate报错的处理
- 检查网络是否可用
- 拦截导弹
- linux popen函数学习
- 关于eclipse出现an error has occurred See the log file
- cover
- UVA 489 Hangman Judge
- PHP 判断一个数组是否为空
- 立体定向多位修复术的技术优势
- xcode5 树形浏览文档的方法 document tree index
- SQL中on条件与where条件的区别
- 这里有些JAVA的免费课程分享
- vim支持nesC语法高亮问题
- 如何在linux系统中设置ip地址