compile problem

why is it showing in valid operator
1 ≤ K ≤ 100,000

Use this:

	int res=(pow(k,res));

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. :slight_smile:

As per my knowledge % works only for integers(int)…for long long int you should have used fmod(x,y);

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()??