Ceiling Sum solution codechef

You are given two integers A,BA,B. You have to choose an integer XX in the range [minimum(A,BA,B), maximum(A,BA,B)] such that:⌈B−X2⌉+⌈X−A2⌉⌈B−X2⌉+⌈X−A2⌉ is maximum. What is the maximum sum you can obtain if you choose XX optimally? Note: ⌈x⌉⌈x⌉ : Returns the smallest integer that is greater than or equal to xx (i.e rounds up to the nearest integer). For example, ⌈1.4⌉=2⌈1.4⌉=2, ⌈5⌉=5⌈5⌉=5, ⌈−1.5⌉=−1⌈−1.5⌉=−1, ⌈−3⌉=−3⌈−3⌉=−3 , ⌈0⌉=0⌈0⌉=0. Input Format First line will… Continue reading Ceiling Sum solution codechef