Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
бинарный поиск
nq1s788
Apr 16th, 2024
221
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
Python
0.23 KB
| None
|
0
0
raw
download
clone
embed
print
report
a
=
list
(
map
(
int
,
input
(
)
.
split
(
)
)
)
#[2, 5, 7, 9]
x
=
int
(
input
(
)
)
#индекс первого, >= x
l
=
-
1
r
=
len
(
a
)
while
r - l
>
1
:
m
=
(
l + r
)
//
2
if
a
[
m
]
>=
x:
r
=
m
else
:
l
=
m
print
(
r
)
Add Comment
Please,
Sign In
to add comment
Public Pastes
Untitled
2 hours ago | 7.90 KB
Untitled
Bash | 3 hours ago | 3.53 KB
dm.cfg
9 hours ago | 1.00 KB
Untitled
10 hours ago | 8.11 KB
Untitled
PHP | 11 hours ago | 1.35 KB
Untitled
17 hours ago | 1.42 KB
Untitled
18 hours ago | 15.21 KB
Untitled
19 hours ago | 0.01 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!