#BZOJ2572. Zju1017 The Bermuda Triangle
Zju1017 The Bermuda Triangle
题目描述
People in the hidden region of the Bermuda Triangle make everything they need in triangular shapes. One day, someone decided to break the rule and bake a hexagonally shaped cake. But as usual, he has to serve the cake in triangular pieces. The pieces are equilateral triangles but in different sizes for different people. He can use as many triangles as needed to cut the cake into pieces, such that nothing remains from the cake. For example, the following figure shows one way that a hexagon with side 9 can be cut into triangles with side 2 and 3. (The cake is cut along the thick lines, thin lines are drawn to show the sizes).
给出蛋糕的边长,和N种能作为原料的小正三角形的边,问能否拉出这个蛋糕。
输入格式
输出格式
3
5 2 2 3
7 2 3 2
13 2 2 3
NO
NO
YES