LOL I agree with Richard & Sergey in WTF but even funnier is reading the code
I am wondering if it ever comes out surely it just deadloops forever if value k is too big that is my guess.
These lines of code are the best ever
int i=1;
while(k>i*(i+1)/2)
Lets give you a hint:
i) k is a LONG LONG and i is an INTEGER.
- You are going to be a little hard pressed to multiply roll an INT up to a LONG LONG
Then you go and do it all again with integer j.
I must say you got me, I can't work out if you are trying to get upperand lower longs of the long long or get the square root in a strange way. It sort of looks like you may be trying to do this
unsigned long llsqrt (unsigned long long x){
unsigned long long op, res, one;
op = x;
res = 0;
one = 0x4000000000000000;
while (one > op) one >>= 2;
while (one != 0) {
if (op >= res + one) {
op -= res + one;
res += one << 1;
}
res >>= 1;
one >>= 2;
}
return (unsigned long) res;
}