implenting basic segment tree…cross checked many times…still getting wrong answer…pls help where am i doing wrong…? here is my code’s link-.http://www.codechef.com/viewsolution/2172202
Replace this statement: float f,g,h; for this one: double f,g,h;
Meaning variables f,g and h should be double instead of float which caused losses of precision in your code. Read this StackOverFlow post.
Your logic is correct so by doing what I mentioned your code will get AC.
Next time PLEASE MAKE YOUR CODE READABLE… Don’t just name your variables a, b, c, d… It will help you code better and it will help others to help you;
Avoid using cin and cout (it can lead to TLE in some problems), use printf and scanf instead;
Indent your code, it will also make it easier to read, understand and debug.
thanx junior94 …!!
Can you help me pls… getting WA on codechef dont know why???