POJ1069 The Bermuda Triangle DFS
生活随笔
收集整理的這篇文章主要介紹了
POJ1069 The Bermuda Triangle DFS
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這個坐標系建的真牛。。。。。。比賽碰到這種題目,必跪。。。。。。
見坐標是給每一個單位三角分配,不是一個點分配。
有兩種建立方法,我用了夾角120方法。。。。。都一樣的。。。
The Bermuda Triangle| Time Limit:?2000MS | ? | Memory Limit:?32768K |
| Total Submissions:?1096 | ? | Accepted:?509 |
Description
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).?Input is a hexagon and triangle types (specified by the length of their sides) and the goal is to decide if the hexagon can be completely divided by the given triangle types.
Input
The first line of the input file contains a single integer t (1 <= t <= 10), the number of test cases, followed by the input data for each test case. Each test case consists of a single line, containing s (1 <= s <= 25), the length of the hexagon's side, followed by n, the number of triangle types (1 <= n <= 10), followed by n integers representing the length of each triangle type's side (between 1 and 25, inclusive).Output
There should be one output line per test case containing either YES or NO depending on whether the hexagon can be completely divided by the given triangle types.Sample Input
3 5 2 2 3 7 2 3 2 13 2 2 3Sample Output
NO NO YES
總結
以上是生活随笔為你收集整理的POJ1069 The Bermuda Triangle DFS的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Byte measurements
- 下一篇: 云计算的三种服务模式:IaaS、PaaS