Блог пользователя heysem

Автор heysem, история, 4 года назад, По-английски

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!

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

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)

»
4 года назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

You can apply binary search, find the largest x such that x^k <= n.