Hello Codeforces,
I've been practicing C++ to improve myself but I kinda stuck with a question. I was hoping you could help.
I met the sqrt(); function and I wonder if I could make it up to 3rd or 4th and even more degrees of root? How can I do that?
Sorry for the bad English btw I am a new learner and I am trying hard to fix my mistakes so if you have any corrections about the usage of language pls inform me.
Thanks already!
One of the methods is to use the pow() function. To calculate the Kth root of N, use pow(N, 1/K). (Remember to use double)
Also you can use cbrt to find cubic root of a number.
Thanks!
Thanks a lot! I will try that.
You can apply binary search, find the largest x such that x^k <= n.
What's binary search? I have no idea what it is.
I feel like I won't do justice to Binary Search if I tried to explain it. I'd recommend this article - Binary Search