Help me in solving P2149 problem

My issue

something wrong with my code Preformatted text`

My code

#include <bits/stdc++.h>
using namespace std;

int magicalWrold(int a, int b, int x){
    if(a*b<=x*x){
        return 0;
    }
    int count=0;
    while(a*b>x*x){
        b=1;
        count+=1;
        if(a*b>x*x){
            a=1;
            count+=1;
        }
    }
    return count;
    
}
int main() {
	int t;
	cin >> t;
	while(t--){
	    int a;
	    int b;
	    int x;
	    
	    cin >> a >> b >> x;
	    
	    cout << magicalWrold(a,b,x) << endl;
	    
	}
    
    return 0;
}

Problem Link: Magical World Practice Coding Problem