P10030 题解

结论很好想,只有当 \(b=0\land c\ne 0\) 时才输出 no。因为 \(p\) 是质数,且 \(b<p\)\(\gcd(p,b)=1(b\ne 0)\),所以可以一直进行第二种操作使 \(x=c\),输出 yes。但如果 \(b=0\)\(x\) 的值永远只会为 \(0\),此时除非 \(c=0\),那么 \(x\ne c\),输出 no

//新年快乐。
#include<bits/stdc++.h>

using namespace std;

int t, p, a, b, c;

int main() {
	cin >> t;
	while (t--) {
		cin >> p >> a >> b >> c;
		if (b == 0 && c != 0) puts("no");
		else puts("yes");
	}
	return 0;
}
posted @ 2024-01-13 15:05  FurippuWRY  阅读(23)  评论(0)    收藏  举报