My issue
i’ve done according to my knowledge what is best all test cases are showing correctly but hidden test cases are not running and throwing me errors as wrong answer.
My code
// Update the code below to solve this problem
import java.util.Scanner;
class Codechef
{
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);
int t = read.nextInt();
for(int i=0; i<t; i++)
{
int p = read.nextInt();
if(p>100 && (p/100) <=10 && (p%100)<=10){
int r=((p/100)+(p%100));
if(r<=10){
System.out.println(r);
}
else{
System.out.println(-1);
}
}
else if(p<=10){
System.out.println(p);
}
else {
System.out.println(-1);
}
}
}
}
Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone