1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 11:21:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part1

This commit is contained in:
2022-03-27 20:37:52 +08:00
parent 8e542045d1
commit c554fc6908
1285 changed files with 108123 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<p><code>n</code> 位乘客即将登机,飞机正好有 <code>n</code> 个座位。第一位乘客的票丢了,他随便选了一个座位坐下。</p>
<p>剩下的乘客将会:</p>
<ul>
<li>
<p>如果他们自己的座位还空着,就坐到自己的座位上,</p>
</li>
<li>当他们自己的座位被占用时,随机选择其他座位</li>
</ul>
<p><code>n</code>&nbsp;位乘客坐在自己的座位上的概率是多少?</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 1
<strong>输出:</strong>1.00000
<strong>解释:</strong>第一个人只会坐在自己的位置上。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong> n = 2
<strong>输出:</strong> 0.50000
<strong>解释:</strong>在第一个人选好座位坐下后,第二个人坐在自己的座位上的概率是 0.5。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 10^5</code></li>
</ul>