I’m unable to understand the logic behind this question. There’s no editorial on this question. Can someone please help me out ? Thanks

I am not sure but this

https://www.codechef.com/COOK108A/problems/EXPTPROD

Question seems very much similar. And it has editorial as well. This might help

4 Likes

Read https://www.codechef.com/COOK106A/problems/EXPXOR/ first.

Along with that, you will need digit DP to count total nos in the range [1,N] with ith bit on. Later you can work on the lines of EXPTPROD to find expect prob of ith bit on.

4 Likes