CF1881B.Three Threadlets
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Once upon a time, bartender Decim found three threadlets and a pair of scissors.
In one operation, Decim chooses any threadlet and cuts it into two threadlets, whose lengths are positive integers and their sum is equal to the length of the threadlet being cut.
For example, he can cut a threadlet of length 5 into threadlets of lengths 2 and 3, but he cannot cut it into threadlets of lengths 2.5 and 2.5, or lengths 0 and 5, or lengths 3 and 4.
Decim can perform at most three operations. He is allowed to cut the threadlets obtained from previous cuts. Will he be able to make all the threadlets of equal length?
很久以前,调酒师德西姆找到了三根线段和一把剪刀。
在一次操作中,德西姆任选一根线段,并将其剪成两根长度均为正整数的新线段,且这两根新线段的长度之和等于被剪线段的原长度。
例如,他可以将一根长度为 5 的线段剪成长度分别为 2 和 3 的两根线段,但不能将其剪成长度为 2.5 和 2.5 的两根线段(非整数),也不能剪成长度为 0 和 5(非正整数)或 3 和 4(和不等于 5)的两根线段。
德西姆最多可执行三次操作。他允许对之前操作所得到的线段继续进行剪裁。他能否通过这些操作使得所有线段长度均相等?
输入格式
The first line contains an integer t (1≤t≤104) — the number of test cases. Then follows the description of each test case.
In a single line of each test case, there are three integers a, b, c (1≤a,b,c≤109) — the lengths of the threadlets.
第一行包含一个整数 t(1≤t≤104)——测试用例的数量。随后是每个测试用例的描述。
每个测试用例占一行,包含三个整数 a、b、c(1≤a,b,c≤109)——线段的长度。
输出格式
For each test case, output "YES" if it is possible to make all the threadlets of equal length by performing at most three operations, otherwise output "NO".
You can output "YES" and "NO" in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer).
对于每个测试用例,如果可以通过至多三次操作使得所有线程段长度相等,则输出 “YES”,否则输出 “NO”。
你可以以任意大小写形式输出 “YES” 和 “NO”(例如,字符串 “yEs”、“yes”、“Yes” 和 “YES” 均会被识别为肯定回答)。
输入输出样例
输入#1
15 1 3 2 5 5 5 6 36 12 7 8 7 6 3 3 4 4 12 12 6 8 1000000000 1000000000 1000000000 3 7 1 9 9 1 9 3 6 2 8 2 5 3 10 8 4 8 2 8 4
输出#1
YES YES NO NO YES YES NO YES NO NO YES YES NO YES NO
说明/提示
Let's consider some testcases of the first test.
In the first testcase, you can apply following operations:
1,3,2→1,2,1,2→1,1,1,1,2→1,1,1,1,1,1.
In the second testcase, you can do nothing, the threadlets are already of equal length.
In the third testcase, it isn't possible to make threadlets of equal length.
我们来考虑第一组测试数据中的一些测试用例。
在第一个测试用例中,你可以执行以下操作:
1,3,2→1,2,1,2→1,1,1,1,2→1,1,1,1,1,1。
在第二个测试用例中,你无需进行任何操作,因为线段长度已经相等。
在第三个测试用例中,无法使所有线段长度相等。
输入解题思路,AI测评打分。不知道怎么写?