res=pow(k,res)%1000000007;
why is it showing in valid operator
1 ≤ K ≤ 100,000
Use this:
int res=(pow(k,res));
res%=1000000007;
You are getting compilation error because pow() returns a double value and % operator is defined only for integer or enumeration type values. Thus, the type of operands mistmatch. So, either typecast your result or do the above manner.
My edit:
long long int res=(long long int)(pow(k,res))%1000000007;
but in the contest i am getting res=0 bcoz of large o/p values of pow()??
As per my knowledge % works only for integers(int)…for long long int you should have used fmod(x,y);