• + 0 comments

    some tese case fail this code .....can you tell why that.....??

    int solve(long int d,long int k) { int r=sqrt(d); int t,p,ans=4; //char *possible,*impossible;

    if((r==1 && k>=4) || (r==2 && k>=4))
            return 1;
    
    
    if(r>2)
    {
    
            p=2,t=2;
            while((r-2)>2 && (r-t)>=2)
            {
                    p=floor((r-t)/2);
                    t=(t+p);
                    ans+=4;
            }
    
    
    }
     if(ans<=k)
                return 1;
            else
                return 0;        
    

    }