https://www.codechef.com/problems/J7

can anyone help me out with the logic ?
problem link: J7 Problem - CodeChef

this is simple, if you know the application of derivatives in mathematics, you can do it easily
In India class 12 NCERT Text Book refer to CHAPTER 6

https://ncert.nic.in/textbook.php?lemh1=6-6