Problems with Java

http://www.codechef.com/viewsolution/4621669

http://www.codechef.com/viewsolution/3521153

Hi. Could anybody explain me what is the matter with the Java solution. It gives NZEC, but it is excatly like the C++ one. Tnank you.