Hi, Help me solve P2149

cook your dish here

for tc in range(int(input())):
a,b,x=map(int,input().split())
if(ab<=xx):
print(0)
else:
if(a<=x or b<=x):
print(1)
else:
print(2)

My code is failing
Can anyone give me a test case where this fails and help me understand?

The testcase you’re stuck with might be this
1
3 3 2

From what i understand, we just need to verify 3 things,

  1. If area the rectangle is already smaller than or equal to the square, no need to make any change.
  2. If reducing either side of the rectangle to 1 can satisfy the condition. This will ensure only 1 change satisfies codition.
  3. if none of the above cases fulfill the ask, we must have to perform more than 1 change.

LOGIC:
if (A * B <= X * X) {
System.out.println(0);
} else if (A <= X || B <= X || (1 * B <= X * X) || (A * 1 <= X * X)) {
System.out.println(1);
} else {
System.out.println(2);
}

Solution: CodeChef: Practical coding for everyone
Hope this helps. Good luck !!!