这题题目中有个单词打错了害我题意理解了好几天,只能打dota2消遣,其中 “ whose serial is divisable by i ” 其实是 " whose serial is divisible by i "
这题要注意的地方是 2^32 -1 , 整个题目很简单就判断一个数是否是完全平方数
1 #include<iostream> 2 #include<math.h> 3 using namespace std; 4 int main(){ 5 unsigned long n; 6 while(cin>>n){ 7 if(!n) 8 break; 9 unsigned long num=0; 10 num=(unsigned long)sqrt((double)n); 11 if(num*num-n==0) 12 cout<<"yes"<<endl; 13 else 14 cout<<"no"<<endl; 15 } 16 }