I got a correct answer for my problem by using custom input . however it throws a Exception:java.util.NoSuchElementException whenever I try to run without custom input . how can I sove it ?
If you don’t provide any Custom Input, then no input is provided to your program, hence the exception - see here for more details!
can it be occur because of invalid Constrains ?
java.util.NoSuchElementException due to invalid constraints? Possible, I suppose, but the testcases would have to be badly screwed up.
Why do you ask?
cause i get an answer as Wrong solution whenever i try to submit it . so i want to ask you can i get it because of this Exception
No, in that case you’d get a RE (Runtime Error) instead of a WA (Wrong Answer). Assuming you didn’t catch and smother the exception, that is, as some people unfortunately do.