Блог пользователя abcsumits

Автор abcsumits, история, 3 года назад, По-английски

I have to find min value of [a/x]+[b/x]+x-1 ,where x belongs to (1,10^9) ,here [] denotes ceil value. I then observed it is monotonic in nature. Its graph will be like

The only problem i am having is to find slope(from slope i meant if every step is assumed as points ,this will help me to shift l and r) and slope can be find by use of its previous neighbour points to find neighbour of y=f(x),we need to find length of y so for given y=[a/x]+[b/x]+x-1 i need the range of the solution

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

??

»
3 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

You can try ternary search

»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Where have you seen that problem? I'll gladly help you if you link the source of the problem.

»
3 года назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

This problem can be effectively addressed using calculus, leveraging some pivotal concepts to unravel the given predicament.

1.When we differentiate an equation, we derive its slope.

2.The points of minimum or maximum correspond to instances where the slope equals zero.

3.For every point where the slope is zero:

a. If the second differentiation is positive, it signifies a minimum.
b. Conversely, if it's negative, it indicates a maximum.

So Now,

Applying differentiation to both sides, we arrive at y' = -[a/x^2] — [b/x^2] + 1. Upon equating y' to 0, we deduce x = √(a+b) and -√(a+b).

Subsequently, performing a secondary differentiation yields y" = 2[a/x^3] + 2[b/x^3]. When evaluating for x = √(a+b), we ascertain a minimum as y" remains positive at this point.

»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

chatGPT is not a trustable for CP coding