Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我晕了,各位哥哥,我的怎么就是不过啊

Posted by godisagirl at 2007-04-19 08:33:26 on Problem 2092
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator