#abc336b. B - CTZ

B - CTZ

Score: 200200 points

问题描述

对于正整数 XX,令 ctz(X)\text{ctz}(X) 表示 XX 的二进制表示末尾的 连续零 数量(最大值)。 如果 XX 的二进制表示以 11 结尾,则 ctz(X)=0\text{ctz}(X)=0

给定一个正整数 NN,输出 ctz(N)\text{ctz}(N)

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

For a positive integer XX, let ctz(X)\text{ctz}(X) be the (maximal) number of consecutive zeros at the end of the binary notation of XX.
If the binary notation of XX ends with a 11, then ctz(X)=0\text{ctz}(X)=0.

You are given a positive integer NN. Print ctz(N)\text{ctz}(N).

Constraints

  • 1N1091\leq N\leq 10^9
  • NN is an integer.

Input

The input is given from Standard Input in the following format:

NN

Output

Print ctz(N)\text{ctz}(N).

Sample Input 1

2024

Sample Output 1

3

20242024 is 11111101000 in binary, with three consecutive 0s from the end, so ctz(2024)=3\text{ctz}(2024)=3.
Thus, print 33.

Sample Input 2

18

Sample Output 2

1

1818 is 10010 in binary, so ctz(18)=1\text{ctz}(18)=1.
Note that we count the trailing zeros.

Sample Input 3

5

Sample Output 3

0

update @ 2024/3/10 01:24:55