题解 | 魔法棒
魔法棒
https://www.nowcoder.com/practice/976bd95dda8f4430b512d0c39bd9f106
#include<stdio.h>
int main(){
int T;
scanf("%d",&T);
while(T){
long long x;
scanf("%lld",&x);
if(x>=15){
printf("Yes\n");
}
else{
if((x-4)%3==0||x>=9&&(x-9)%3==0||x==1) //14<4*4,从2,3的平方数开始验算
printf("Yes\n");
else
printf("No\n"); //包括2,3等不符的所有数
}
T--;
}
}
查看2道真题和解析