思路
大正方形必然是由平方个小正方形拼成,小正方形要么全是两个三角形拼成、要么全是四个三角形拼成。
所以只需要判断n/2或者n/4是不是平方数即可
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n==2||n==4){cout<<"YES"<<'\n';continue;}
bool ck=false;
int tmp=n/2;
if(n%2==0&&(int)sqrt(tmp)*sqrt(tmp)==tmp)ck=true;
tmp=n/4;
if(n%4==0&&(int)sqrt(tmp)*sqrt(tmp)==tmp)ck=true;
if(ck)
cout<<"YES"<<'\n';
else cout<<"NO"<<'\n';
}
}