每个测试文件均包含多组测试数据。第一行输入一个整数
代表数据组数,每组测试数据描述如下:
在一行上输入四个整数
代表一次询问。
对于每一组测试数据,如果等式成立,在一行上输出
;否则,直接输出
。
3 1 4 2 2 2 3 8 1 4 7 6 2
YES YES NO
对于第一组测试数据,
成立。
对于第二组测试数据,
成立。
在几乎全部的情况下,
的运行速度优于
,我们建议您选择对应版本的
进行提交、而不是
。
#include <bits/stdc++.h>
using namespace std;
signed main() {
int t;
cin >> t;
while (t -- ) {
vector<int> a(4);
for (auto &e : a) cin >> e;
sort(a.begin(), a.end());
bool t = false;
do {
t |= (pow(a[0], a[1]) == pow(a[2], a[3]));
} while (next_permutation(a.begin(), a.end()));
puts(t ? "YES" : "NO");
}
return 0;
}