My issue
My code
// Update the code below to solve this problem
import java.util.Scanner;
class Codechef
{
public static int problemsSolved(int totalScore) {
if (totalScore < 0 || totalScore % 100 != 0) {
return -1; // Invalid score
}
return totalScore / 100; // Number of problems solved
}
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);
int t = read.nextInt();
int[] testCases = new int[t];
for(int i=0; i<t; i++)
{
int p = read.nextInt();
testCases[i] = read.nextInt();
}
for ( int j = 0; j < t; j++) {
int numProblemsSolved = problemsSolved(testCases[j]);
System.out.println( numProblemsSolved);
}
}
}
Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone