Help me with TWONMS

Question Link: TWONMS Problem - CodeChef

although I am getting all the testcases passed on my local compiler but on submission I am getting partially correct answer. Can you guyz help me regarding this?
S.N. I am a beginner.

My Code:

#include<bits/stdc++.h>

using namespace std;

int main()

{

int T;

cin>>T;

while(T--)

{

    int A,B,N;

    cin>>A>>B>>N;

    int result = 0;

    for(int i =0;i<N;i++)

    {       

        if(i%2==0)

        {

            A *= 2;

        }

        else

        {

            B *=2; 

        }

        result = max(A,B)/min(A,B);      

    }

    cout << result<< endl;       

}

return 0;

}

Your code has integer overflow when you are writing B*=2;,A *=2
Try to use a different logic instead of multiplying them really .

You are not supposed to do it that way. You can solve the problem in O(1) per test case. You can refer to the editorial.
https://discuss.codechef.com/problems/TWONMS