- laiyuan 的博客
平方之和
- @ 2025-12-1 18:48:35
#include<bits/stdc++.h>
using namespace std;
int a,arr[20];
int x;
int main() {
cin >> a;
for(int i=0;i<a; i++) {
int n;
cin >> n;
for(int j=1;j<=n; j++) {
arr[j] = j * j;
x = 0;
}for(int j = 1;j <= n; j++){
for(int d = 1;d <= a; d++){
if(arr[j] + arr[d] == n && j != d){
cout << "Yes" << endl;
x = 1;
break;
}
}
if(x == 1) {
break;
}
}
if(x == 0) {
cout << "No" << endl;
}
}
return 0;
}