We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;classSolution{staticvoidMain(String[]args){intn=Convert.ToInt32(Console.ReadLine());intp=Convert.ToInt32(Console.ReadLine());// your code goes hereintfromBack;intfromFront=(int)Math.Ceiling(((float)(p-1))/2);if(n%2==1){fromBack=(n-p)/2;}else{fromBack=(int)Math.Ceiling(((float)(n-p))/2);}if(fromFront<=fromBack)Console.WriteLine(fromFront);elseConsole.WriteLine(fromBack);}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Drawing Book
You are viewing a single comment's thread. Return to all comments →