CTZ

AtCoder
IDabc336_b
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
2024
Output #1
3

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

$18$ is `10010` in binary, so $\text{ctz}(18)=1$.  
Note that we count the trailing zeros.
Input #3
5
Output #3
0
API Response (JSON)
{
  "problem": {
    "name": "CTZ",
    "description": {
      "content": "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{",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc336_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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$.  \nIf the binary notation of $X$ ends with a $1$, then $\\text{...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments