Problem :- http://www.codechef.com/problems/D1/
C++ solution:- http://ideone.com/rHBBrW Java solution:- http://ideone.com/Odb6hT
Fact is that i am getting TLE while submitting code in C++ and in am getting wrong answer while submitting code in java .But code is exactly same(no change in code). I just implemented the editorial given of the problem.
Plz anyone help....