My issue
include <stdio.h>
int main(void) {
int t;
scanf(“%d”,&t);
while(t–)
{
int a,b,x,r,s,y,res,count=0;
scanf(“%d %d %d”,&a,&b,&x);
s=(xx);
r=(ab);
while(s<=r)
{
y=(a-1);
a=a-y;
count++;
r=(ab);
if(s<r)
{
res=(b-1);
b=b-res;
count++;
}
r=(ab);
}
printf("%d\n",count);
}
}
I am getting time limit exceeded error???
My code
#include <stdio.h>
int main(void) {
int t;
scanf("%d",&t);
while(t--)
{
int a,b,x,r,s,y,res,count=0;
scanf("%d %d %d",&a,&b,&x);
s=(x*x);
r=(a*b);
while(s<=r)
{
y=(a-1);
a=a-y;
count++;
r=(a*b);
if(s<r)
{
res=(b-1);
b=b-res;
count++;
}
r=(a*b);
}
printf("%d\n",count);
}
}
Problem Link: Magical World Practice Coding Problem