Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long long nroot(int n,long long x)
- {
- if(x<0)
- x=-x;
- else
- if(x==0)
- return 0;
- double m,st=0,dr=x+0.01;
- while(dr-st>0.01)
- {
- m=(st+dr)/2;
- if(pow(m,n)>x)
- dr=m;
- else
- st=m;
- }
- return (long long) dr;
- }
Add Comment
Please, Sign In to add comment