1 Star 41 Fork 18

小墨/力扣题库(完整版)

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
find-the-winning-player-in-coin-game.html 1.51 KB
Copy Edit Raw Blame History
zhangbk1 authored 2024-08-06 08:46 +08:00 . update
<p>You are given two <strong>positive</strong> integers <code>x</code> and <code>y</code>, denoting the number of coins with values 75 and 10 <em>respectively</em>.</p>
<p>Alice and Bob are playing a game. Each turn, starting with <strong>Alice</strong>, the player must pick up coins with a <strong>total</strong> value 115. If the player is unable to do so, they <strong>lose</strong> the game.</p>
<p>Return the <em>name</em> of the player who wins the game if both players play <strong>optimally</strong>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">x = 2, y = 7</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;Alice&quot;</span></p>
<p><strong>Explanation:</strong></p>
<p>The game ends in a single turn:</p>
<ul>
<li>Alice picks 1 coin with a value of 75 and 4 coins with a value of 10.</li>
</ul>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">x = 4, y = 11</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;Bob&quot;</span></p>
<p><strong>Explanation:</strong></p>
<p>The game ends in 2 turns:</p>
<ul>
<li>Alice picks 1 coin with a value of 75 and 4 coins with a value of 10.</li>
<li>Bob picks 1 coin with a value of 75 and 4 coins with a value of 10.</li>
</ul>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= x, y &lt;= 100</code></li>
</ul>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/coder-xiaomo/leetcode-problemset.git
git@gitee.com:coder-xiaomo/leetcode-problemset.git
coder-xiaomo
leetcode-problemset
力扣题库(完整版)
master

Search