Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我晕了,各位哥哥,我的怎么就是不过啊#include<stdio.h> #include<cmath> int main() { int n,m,i,a,count; while(scanf("%d %d",&n,&m) != EOF&&n!=0||m!=0) { if(m==0&&n==0) { return 0; } if(m==0) { printf("Yes\n"); continue; } if(m>=0) { count=0; for(i=1;i<=sqrt(m);i++) { if(m%i==0) { a=m/i; if((a+i)==n||(a+i==-n)) { count++; break; } } } if(count==0) printf("No\n"); else printf("Yes\n"); } if(m<0) { count=0; m=m*(-1); for(i=1;i<=sqrt(m);i++) { if(m%i==0) { a=m/i; if((a-i)==n||(i-a)==n) { count++; break; } } } if(count==0) printf("No\n"); else printf("Yes\n"); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator