can any one suggest the mistake in this code for problem chef and keyboard

import java.util.*;
class chefkey
{
public static void main(String ar[])
{long count=0;
Scanner sc= new Scanner(System.in);
System.out.println(“Enter no of test cases”);
int tc= sc. nextInt();
while (tc>0&&tc<=100)
{count=0;
System.out.println(“Enter n m c”);
int n= sc.nextInt();long m= sc.nextLong();long c= sc.nextLong();
if(n>=1&&m<=1000000&&c>=1&&c<=1000000)
{for(long i=1;i<=c;i++)
{
if (c%i==0)
{
if(i<=n&&c/i<=m)
count++;
}
}
if(count>0) System.out.println(count);else System.out.println(“0”);
tc–;
}
}
}
}

Dont print superfluous print statements, it gives a WA. Its a machine checking if your output is an exact match of expected output or not.

1 Like

Don’t print unnecessary print statements, stick to the test cases as they are given.

you can see my solution here, if this is the question.

// Sandeep gupta // IIIT Jabalpur
#include<stdio.h>
#include<math.h> int main() {

int t,i,n,m,c,max,j,ans=0;

// only taking test cases as input nothing else

scanf("%d",&t);

while(t--)

{

// taking input in n, m and c (not printing anything apart from answer.)

    scanf("%d %d %d",&n,&m,&c);

    ans = 0;

    if(n < m)

    {

        max = m;

    }

    else

    {

        max = n;

    }

    for(i=1;i<=max;i++)

    {

        if(c%i == 0 && (i <= n && i <= m))

        {

            if(c/i <= n || c/i <= m)

            {

                ans++;

            }

        }

    }

    printf("%d\n",ans);

} 

}

Don’t print anything apart from answers.

Hope this helps!

//