题解 | 魔法棒 | a*b - a - b
魔法棒
https://www.nowcoder.com/practice/976bd95dda8f4430b512d0c39bd9f106
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<bool> f(14);
f[0]=true;
for(int i=0;i<14;i++){
if(f[i]){
for(int j=1;i+j*j-1<14;j++){
f[i+j*j-1]=true;
}
}
}
int T;
long long x;
cin>>T;
while(T--){
cin>>x;
x--;
if(x>=14||f[x]){
cout<<"Yes\n";
}else {
cout<<"No\n";
}
}
}
// 64 位输出请用 printf("%lld")