CF--1624B.Make AP

本文探讨了一个关于等差数列的问题,即如何通过一次操作将三个正整数a, b, c变为等差数列。关键在于判断a+c是否等于2b以及是否能通过乘以某个正整数使它们成为等差数列。解决方案涉及到了整除性和条件判断,对于编程和数学思维有一定启发。

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

Polycarp has 33 positive integers aa, bb and cc. He can perform the following operation exactly once.

  • Choose a positive integer mm and multiply exactly one of the integers aa, bb or cc by mm.

Can Polycarp make it so that after performing the operation, the sequence of three numbers aa, bb, cc (in this order) forms an arithmetic progression? Note that you cannot change the order of aa, bb and cc.

Formally, a sequence x_1, x_2, \dots, x_nx1​,x2​,…,xn​ is called an arithmetic progression (AP) if there exists a number dd (called "common difference") such that x_{i+1}=x_i+dxi+1​=xi​+d for all ii from 11 to n-1n−1. In this problem, n=3n=3.

For example, the following sequences are AP: [5, 10, 15][5,10,15], [3, 2, 1][3,2,1], [1, 1, 1][1,1,1], and [13, 10, 7][13,10,7]. The following sequences are not AP: [1, 2, 4][1,2,4], [0, 1, 0][0,1,0] and [1, 3, 2][1,3,2].

You need to answer tt independent test cases.

Input

The first line contains the number tt (1 \le t \le 10^41≤t≤104) — the number of test cases.

Each of the following tt lines contains 33 integers aa, bb, cc (1 \le a, b, c \le 10^81≤a,b,c≤108).

Output

For each test case print "YES" (without quotes) if Polycarp can choose a positive integer mm and multiply exactly one of the integers aa, bb or cc by mm to make [a, b, c][a,b,c] be an arithmetic progression. Print "NO" (without quotes) otherwise.

You can print YES and NO in any (upper or lower) case (for example, the strings yEs, yes, Yes and YES will be recognized as a positive answer).

Sample 1

InputcopyOutputcopy
11
10 5 30
30 5 10
1 2 3
1 6 3
2 6 3
1 1 1
1 1 2
1 1 3
1 100000000 1
2 1 1
1 2 2
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES

Note

In the first and second test cases, you can choose the number m=4m=4 and multiply the second number (b=5b=5) by 44.

In the first test case the resulting sequence will be [10, 20, 30][10,20,30]. This is an AP with a difference d=10d=10.

In the second test case the resulting sequence will be [30, 20, 10][30,20,10]. This is an AP with a difference d=-10d=−10.

In the third test case, you can choose m=1m=1 and multiply any number by 11. The resulting sequence will be [1, 2, 3][1,2,3]. This is an AP with a difference d=1d=1.

In the fourth test case, you can choose m=9m=9 and multiply the first number (a=1a=1) by 99. The resulting sequence will be [9, 6, 3][9,6,3]. This is an AP with a difference d=-3d=−3.

In the fifth test case, it is impossible to make an AP.

a b c -->性质 等差数列:a+c=2b

10 5 30 a+c>2b :那么为了使两边一样大,需要增大b,使得a+c=2b   那么b是否有这个潜力呢?再写个判断  ((a+c)/2)%b==0?    来判断我们需要的那个b是否为现在的b的倍数  ,是的话就YES,不是就NO

30 5 10 同上

1 2 3 a+c=2b 直接输出YES

1 6 3  a+c<2b  :同理增大a或者是c   判断一下只要有一个可以构成a+c=2b就YES,否则NO

#include<bits/stdc++.h>
using namespace std;
int a,b,c;

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		cin>>a>>b>>c;
		if((a+c)>(2*b))//a+c大了,那么就让b也变大 
		{
			if((a+c)%(2*b)==0)
			cout<<"YES"<<endl;
			else
			cout<<"NO"<<endl;
		}
		else if((a+c)<(2*b))//为了使两边相等,那么增大a或者是c 
		{
			if(((2*b)-a)%c==0)
			cout<<"YES"<<endl;
			else if(((2*b)-c)%a==0)
			cout<<"YES"<<endl;
			else 
			cout<<"NO"<<endl;
			 
		}
		else
		{
			cout<<"YES"<<endl;
		}
	}
	return 0;
}

Node.js 的官方发布页面提供了各个版本的下载链接以及对应的校验和信息。对于 Node.js v14.17.0 版本,可以访问其官方镜像站点获取具体的文件资源和校验和。 ### 下载地址 Node.js v14.17.0 的二进制文件和其他相关资源可以从以下 URL 获取: - **Windows Installer**: https://nodejs.org/dist/v14.17.0/node-v14.17.0-x64.msi - **macOS Installer**: https://nodejs.org/dist/v14.17.0/node-v14.17.0.pkg - **Linux Binaries (x64)**: https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz 此外,还可以找到其他平台的相关文件,例如 ARM 架构支持等。 ### 校验和信息 Node.js 提供了一个名为 `SHASUMS256.txt` 的文件来验证下载文件的真实性与完整性。该文件包含了所有发布的压缩包及其对应的安全哈希值(SHA-256)。可以通过以下链接下载并核对: - **SHASUMS256.txt**: https://nodejs.org/dist/v14.17.0/SHASUMS256.txt 以下是部分校验和示例(仅作为说明用途,请以实际下载为准): ```plaintext eacf3b9aaf2f8c2d0daaafebfedfaabcbaacdbebdffdfdcdbcaebabcfdebcddcdcbcafecbbcab node-v14.17.0-darwin-x64.tar.gz ... ``` 如果需要单独提取某个特定文件(如 `node.lib`),可以根据目标操作系统选择合适的发行版解压后查找相关内容。通常情况下,`node.lib` 文件位于 Windows 平台下的开发工具链目录中[^1]。 为了进一步确认文件一致性,在命令行执行如下操作完成 SHA-256 验证过程: ```bash shasum -a 256 node-v14.17.0-linux-x64.tar.xz ``` 此脚本会计算本地文件散列并与远程服务器提供的一致性对比。 ### 注意事项 当涉及敏感环境部署时务必仔细检查这些数值匹配情况以防篡改风险发生。同时建议始终从可信源处取得最新稳定版本软件产品以便享受更长久的支持周期和服务保障措施[^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值