103361: [Atcoder]ABC336 B - CTZ

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:1 Solved:0

Description

Score: $200$ points

Problem Statement

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

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

Constraints

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

Input

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

$N$

Output

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


Sample Input 1

2024

Sample Output 1

3

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


Sample Input 2

18

Sample Output 2

1

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


Sample Input 3

5

Sample Output 3

0

Input

Output

得分:200分

问题描述

对于一个正整数$X$,令$\text{ctz}(X)$为$X$的二进制表示中结尾的(最大)连续零的个数。

如果$X$的二进制表示以$1$结尾,则$\text{ctz}(X)=0$。

约束条件

  • $1\leq N\leq 10^9$
  • $N$是一个整数。

输入

输入通过标准输入给出以下格式:

$N$

输出

打印$\text{ctz}(N)$。


样例输入1

2024

样例输出1

3

$2024$的二进制表示为11111101000,从结尾开始有三个连续的0,因此$\text{ctz}(2024)=3$。
因此,打印$3$。


样例输入2

18

样例输出2

1

$18$的二进制表示为10010,因此$\text{ctz}(18)=1$。
注意我们计算的是尾随的零。


样例输入3

5

样例输出3

0

加入题单

算法标签: