yukicoder contest 281 参戦記
A 1372 Median of Submasks
MSB(most significant bit) が立つまでと、立った後が同じなので、N の MSB だけ立っているのが答え.
N = int(input())
i = 0
while N != 0:
N >>= 1
i += 1
print(1 << (i - 1))
Go to list of users who liked
More than 3 years have passed since last update.
MSB(most significant bit) が立つまでと、立った後が同じなので、N の MSB だけ立っているのが答え.
N = int(input())
i = 0
while N != 0:
N >>= 1
i += 1
print(1 << (i - 1))
Register as a new user and use Qiita more conveniently
Go to list of users who liked