mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part4
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<p>给你一个整数 <code>n</code> ,请你将 <code>1</code> 到 <code>n</code> 的二进制表示连接起来,并返回连接结果对应的 <strong>十进制</strong> 数字对 <code>10<sup>9</sup> + 7</code> 取余的结果。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre><b>输入:</b>n = 1
|
||||
<b>输出:</b>1
|
||||
<strong>解释:</strong>二进制的 "1" 对应着十进制的 1 。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><b>输入:</b>n = 3
|
||||
<b>输出:</b>27
|
||||
<strong>解释:</strong>二进制下,1,2 和 3 分别对应 "1" ,"10" 和 "11" 。
|
||||
将它们依次连接,我们得到 "11011" ,对应着十进制的 27 。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre><b>输入:</b>n = 12
|
||||
<b>输出:</b>505379714
|
||||
<b>解释:</b>连接结果为 "1101110010111011110001001101010111100" 。
|
||||
对应的十进制数字为 118505380540 。
|
||||
对 10<sup>9</sup> + 7 取余后,结果为 505379714 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n <= 10<sup>5</sup></code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user