CF13B.Letter A
普及+/提高
通过率:0%
时间限制:0.50s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.
You are given three segments on the plane. They form the letter A if the following conditions hold:
- Two segments have a common endpoint (lets call these segments first and second), while the third segment connects two points on the different segments.
- The angle between the first and the second segments is greater than 0 and does not exceed 90 degrees.
- The third segment divides each of the first two segments in proportion not less than 1 / 4 (i.e. the ratio of the length of the shortest part to the length of the longest part is not less than 1 / 4).
小佩佳正在学习写字。老师给学生们布置了任务:在纸上写出字母 A。现在需要检查佩佳是否真的写出了字母 A。
给定平面上的三条线段。当且仅当满足以下条件时,这三条线段构成字母 A:
- 其中两条线段有一个公共端点(我们称这两条线段为第一条和第二条),而第三条线段连接分别位于这两条不同线段上的两个点;
- 第一条与第二条线段之间的夹角大于 0∘ 且不超过 90∘;
- 第三条线段将每一条前两条线段都按比例分割,且该比例不小于 1/4(即:每条被分割的线段上,较短部分长度与较长部分长度之比 ≥1/4)。
输入格式
The first line contains one integer t (1 ≤ t ≤ 10000) — the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers — coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have positive length.
第一行包含一个整数 t(1≤t≤10000)——待解决的测试用例数量。每个测试用例由三行组成,每行包含四个以空格分隔的整数,表示其中一条线段两个端点的坐标。所有坐标的绝对值均不超过 108。所有线段长度均为正数。
输出格式
Output one line for each test case. Print «YES» (without quotes), if the segments form the letter A and «NO» otherwise.
每个测试用例输出一行。如果这些线段构成了字母 A,则输出 «YES»(不带引号);否则输出 «NO»。
输入输出样例
输入#1
3 4 4 6 0 4 1 5 2 4 0 4 4 0 0 0 6 0 6 2 -4 1 1 0 1 0 0 0 5 0 5 2 -1 1 2 0 1
输出#1
YES NO YES
输入解题思路,AI测评打分。不知道怎么写?