I am trying to solve TPRODUCT Problem - CodeChef problem. The solution is simple. But storing number in long long is not enough. So I studied the approach of the editorial. It takes logarithm to solve it. I have two doubts.
-
The logarithmic part is not giving correct answer as floating point operations are not accurate. For second test case, the answer is 105, I am getting 104. Here’s my code without modulo operation.
cEHyJ4 - Online C99 Compiler & Debugging Tool - Ideone.com
What can I do to fix it? -
How do I perform the modulo operation on a exponentiation where power is a floating point number? I know modular exponentiation but there base and exponents are integers. What can be done for floating point?