log2(N)

AtCoder
IDabc215_b
Time2000ms
Memory256MB
Difficulty
Given a positive integer $N$, find the maximum integer $k$ such that $2^k \le N$. ## Constraints * $N$ is an integer satisfying $1 \le N \le 10^{18}$. ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
6
Output #1
2

*   $k=2$ satisfies $2^2=4 \le 6$.
*   For every integer $k$ such that $k \ge 3$, $2^k > 6$ holds.

Therefore, the answer is $k=2$.
Input #2
1
Output #2
0

Note that $2^0=1$.
Input #3
1000000000000000000
Output #3
59

The input value may not fit into a $32$\-bit integer.
API Response (JSON)
{
  "problem": {
    "name": "log2(N)",
    "description": {
      "content": "Given a positive integer $N$, find the maximum integer $k$ such that $2^k \\le N$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc215_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given a positive integer $N$, find the maximum integer $k$ such that $2^k \\le N$.\n\n## Constraints\n\n*   $N$ is an integer satisfying $1 \\le N \\le 10^{18}$.\n\n## Input\n\nInput is given from Standard Input...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments