Can't Submit My Solution Due To An Error But The Code Works Fine In My Intellij IDEA

import java.io.*;
import java.util.Scanner;

class EnormousInputTest {

public static void main(String[] args) throws IOException {
    Scanner sc= new Scanner(System.in);
    int Number=sc.nextInt();
    int Divisor=sc.nextInt();
    int c=0,i;
    int num;
    for (i = 0; i <Number ; i++) {
        num=sc.nextInt();
        if (num%Divisor==0)
            c++;

    }
    System.out.println(c);
}

}

Error-
Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at EnormousInputTest.main(Main.java:8)

1 Like

Yup. I was also facing this issue. However I think its a bug. Go ahead and submit the solution(not run it). Your solution is absolutely correct. It would surely be accepted. However @admin please check this bug we are facing in your ide.

@satyamnoob @brij_raj both of you must have ticked “Custom Input” and left the input box as blank. Either uncheck the option or provide the input according to the format.

i am facing this issue too. The “Custom Input” is not ticked and input box left blank. Works otherwise locally

try{
//your code
}
catch(Exception ex)
{
return;
}

can you provide the test case in which you are getting this exception ?

Did you find the solution to this problem? I am also facing the same problem, and i dont know how i can solve this issue.

tell me exactly if its not a live contest
which prob statement ?
whats ur code ? @tbm5k
Can’t help without knowing the issue properly