POJ 1675 Happy Birthday

解决如何将圆形生日蛋糕等分为三份,每份恰好包含一个浆果的问题。通过计算角度和判断条件确定是否能实现合理切分。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

Happy Birthday!
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 3352 Accepted: 791

Description

There are three berries on a round birthday cake. You are required to divide the cake into three identical parts such that each part contains exactly one berry. To make it easy, it is assumed that the radius of the berries is 0 and each part of the cake is a sector with 120 degrees. Any line that divides the cake should not go through any berry.

Input

The first line contains a single integer t (1 <= t <= 20) that indicates the number of test cases. Then follow the t cases. Each case contains exactly 7 integers r, x1, y1, x2, y2, x3 and y3. r is the radius of the cake, (xi, yi) is the coordinates of i-th berry. The center of the cake is at (0, 0) and it's confirmed that all the berries will be on the cake.

Output

For each case, output 'Yes' if there is a valid solution, 'No' otherwise.

Sample Input

2
2 1 1 -1 1 0 -1
10 0 9 1 8 -1 8

Sample Output

Yes
No

Source

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值