跳到正文

题解

题解 P2520 【[HAOI2011]向量】

羚羊WANG约 1 分钟
原文
文章信息与版本

文章信息

发布
2019年5月10日
收录
2026年5月24日
更新
2026年8月23日
篇幅
约 1 分钟
获赞
1
题目
P2520

版本

  1. v1当前
C++
#include<bits/stdc++.h>
using namespace std;
int t;
long long a,b,x,y;//输入
long long gcd(long long a,long long b){
	if(b==0) return a;
	return gcd(b,a%b);
}
int main(){
	cin>>t;
	while(t--)
	{
		cin>>a>>b>>x>>y;
		long long d=gcd(gcd(a*a-b*b,a*a+b*b),2*a*b);只有四种操作
		if((a*x-b*y)%d || abs(b*x-a*y)%d || abs(a*x+b*y)%d || abs(b*x+a*y)%d)
			cout<<"N"<<endl;
		else cout<<"Y"<<endl;输出
	}
}
原文