No Such Element Exception in JAVA

does not have enough karma ,so asking here: why my code for NEO01(chef and feast) gives this error-- Exception in thread “main” java.util.NoSuchElementException at java.util.Scanner.throwFor( at at java.util.Scanner.nextInt( at java.util.Scanner.nextInt( at Codechef.main(

@manoj09 in ur code, u have declared result variable as int type…it should be declared as long
lets take a sample case as
-10^8 -10^8 -10^8 … so on upto 10^5 terms in regard of 30 points…

logically our result will be correct if we make subset of individual element
1* (-10^8)+1* (-10^8)+1* (-10^8)+1* (-10^8)+1* (-10^8)+1* (-10^8)+… upto 10^5 terms

on solving we are getting -10^13 as result which is out of range of int… so declare result variable as long type and if problem persist… just ping me again