means if n is odd we have to multiply a with 2 n/2+1 times,ex n=3 we will multiply n with 2 times thats why n/2+1 and b with n/2 times means 1 times because game is always start from A and if n is even then a is multiplied by n/2 times and b is also n/2 times with 2(same thing if you didnt multiply),but n==1 means we dont have to multiply b because there is only 1 turn so a is multiplied with n only 1 times and rest i used min and max functions

@vivek96 that’s true that if odd we have to multiply with 2 n/2+1 but u see n/2 is common in both those so if n is odd a is getting multiplied by an extra 2 otherwise both are multiplied by same number of 2
The thing is that you need not put that n/2 factor it is common in both.

we will multiply n with 2 times thats why n/2+1 and b with n/2 times means 1 times

Multiply with WHAT? You dont ahve to multiply with n or n/w or anything. Its pow(2,n/2) and pow(2,n/2+1) if i am not wrong. Each turn, the numbers are multiplied by 2.

If we multiply with 2 three times, its 2^3 = 8, not 2x3=6.