mirror of
https://github.com/Hizenberg469/Algorithms-snippets.git
synced 2026-04-20 07:02:23 +03:00
6 lines
129 B
C++
6 lines
129 B
C++
//Binary Search Jump.
|
|
int ans = n;
|
|
for(int b = n/2 ; b >= 1 ; b/=2 ){
|
|
while(check(ans - b))ans -= b;
|
|
}
|
|
cout << ans << endl; |