杭电2092
1 #include<stdio.h> 2 int main() 3 { 4 int n,m,i,j,x; 5 while(~scanf("%d%d",&n,&m)&&(n||m)) 6 { 7 x=m<0?-m:m; 8 for(i=1; i*i<=x; ++i) 9 { 10 if(x%i) 11 continue; 12 else 13 j=m/i; 14 //printf("i-j=%d,j-i=%d\n",i-j,j-i); 15 if(m) 16 { 17 if(i+j==n||-i-j==n) 18 break; 19 } 20 else if(i-j==n||j-i==n) 21 break; 22 } 23 if(i*i>x) 24 printf("No\n"); 25 else 26 printf("Yes\n"); 27 } 28 }