Frame
题目链接:
http://acm.hust.edu.cn/vjudge/contest/130303#problem/D
Description
http://7xjob4.com1.z0.glb.clouddn.com/17e6574035df3f9b6d1fc6dfd8b650ac
The input file contains several test cases, each of them as described below.
The first line contains 2 integers — X and Y (3 ≤ X ≤ 10^6, 3 ≤ Y ≤ 10^6). The second line
contains integer N — the number of tile types to be analyzed (1 ≤ N ≤ 1000). Each of following N
lines contains one integer, not exceeding 10^6. We designate with AK the integer on the (k + 2)-th line of the input file.
Output
For each test case, your goal is to print N lines, where the K-th line should contain the word ‘YES’, if it is possible to tile the frame with size X × Y with tiles AK × 1, and the word ‘NO’ otherwise.
```
5 6
2
3
4
```
Sample Output
```
YES
NO
```
Source
2016-HUST-线下组队赛-4
##题意:
在X*Y的矩形的最外圈放若干个 A*1 的小矩形,判断对于给定的A能够恰好完全覆盖.
##题解:
考虑最上面一行的情况,第一块小矩形要么从#(1,1)开始,要么从#(1,2)开始(留出第一格给竖的矩形).
确定第一块的位置后,后面的摆放情况是固定的,所以依次判断一下是否合法即可.
##代码:
``` cpp
#include
#include
#include
#include
#include
#include
#include
#include