please see why my code (https://www.codechef.com/viewsolution/14246552) for SNELECT gives this and i got this error many times but couldn’t get why? please answer…
this 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 Codechef.main(Main.java:14)
now someone tell why i got this error … and still getting in many other
why do i need to check through in.nextInt() or some other??
and even after checking now it gives runtime error(nzec) why?
someone pls help?
No such element exception usually occurs when your input method isnt in context with given. Like, asking for an extra input, or not minding the white spaces.
Eg-
4
and
4
are different (highlight the text and notice the white space after 4. It can cause exception in java).
If this doesnt help, i will convert it into a question without delay.
Regarding stars, you can find it here- https://blog.codechef.com/2017/03/09/a-star-studded-rating-system/
hey @olofmeister , can you help him get some details on that error. I think its due to negligence of white spaces or something like that. Your opinion?
Hello, i’m a newcomer to CodeChef. During contest I couldn’t find any information about memory/time limit for the task. So if it exists, please show where to look up for it.
time limit and memory limit for a particular question in codechef(any problem may b practice or contest) can be found if u scroll down till bottom… @bobra der u can see details about author,tester,time limit,source code limit !!
happy coding:)
Just a small correction, memory limit is not the source limit. Usually memory limit is ~256 (or 512) MB. You can declare an array size upto 10^8 easily (~10^4 for 2-D array). (Array sizes of 10^9 give error as they take too much memory)
Thanks for helping him dear ^^
@vijju123 @manoj09 , i guess accessing direct elements such as ch[1], without knowing they have been initiated before may lead to a runtime error(i am not 100% sure, as this is a condition of SIGSEG too), but as u can see, u have directly used ch[1] and ch[ch.length-2] which wont be declared for string size of 1, and as expected it gives a runtime error on strings of length 1. I think that could be the case.
thanks everybody …i got it
Thank you. This will help a lot:D
why i m getting this 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 CodeChef.main(Main.java:10)
… in my code https://www.codechef.com/viewsolution/14253104
question from chef and feast(NEO01)