Basically f(x) is summation of power K of absolute value of difference of every pair of array.In this question n(number of element in array),k,and element will be given and i have to fine first absolute difference between every pair of array and raise its power k, then add all them and find the answer%pow(10,9)+7

What I have tried:

I tried this problem by using 3 loops , one for power. because value of k can be go till 100000,and element of array can be go till 10^9

Maybe you can post the exact problem you are trying to solve? As stated it would appear that you need to be able to calculate values in with a magnitude of the order of 1E+900000. That value is far too large for even a long double in 64 bits which would be of the order 1E+4932, so there must be some other constraints on the problem, OR you are expected to use a bignum library to compute the values. That being said, you should also post your code. We are quite happy to review your solution and suggest fixes, but we don't provide solutions outright.

Instead of using three loops with complexity O(n^3), you can use modular exponentiation as the third loop which will take O(log n) to compute power k for the difference of each pair of the array.
I want to add in this question how can we compute summation of differences of each pair raise to power k in less than O(n^2 log n).

That being said, you should also post your code. We are quite happy to review your solution and suggest fixes, but we don't provide solutions outright.