Stuck in problem. sqrt ( mid ) * sqrt ( mid ) > mid how? please help.

Правка en2, от srijon_32, 2024-10-21 01:19:21

I was looking for a solution to a problem. I saw this in a function of that solution:

bool good(ll mid) { ll x = sqrt ( mid ); while( x * x > mid ) x-- ; while( ( x + 1 ) * ( x + 1 ) <= mid ) x++ ; return mid -x >= k; }

how is it possible that: sqrt ( mid ) * sqrt ( mid ) > mid ? or ( sqrt ( mid ) + 1 ) * ( sqrt ( mid ) + 1 ) <= mid ?

all this sqrt has floor value.

That problem link: https://codeforces.net/contest/2020/problem/B

Теги question, need help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский srijon_32 2024-10-21 01:19:21 36 Tiny change: 'id** ?\n\n_That ' -> 'id** ?\n\nall this sqrt has floor value.\n\n_That '
en1 Английский srijon_32 2024-10-21 01:16:37 525 Initial revision (published)