代码拉取完成,页面将自动刷新
<p>Given two strings <code>s</code> and <code>t</code>, each of which represents a non-negative rational number, return <code>true</code> if and only if they represent the same number. The strings may use parentheses to denote the repeating part of the rational number.</p>
<p>A <strong>rational number</strong> can be represented using up to three parts: <code><IntegerPart></code>, <code><NonRepeatingPart></code>, and a <code><RepeatingPart></code>. The number will be represented in one of the following three ways:</p>
<ul>
<li><code><IntegerPart></code>
<ul>
<li>For example, <code>12</code>, <code>0</code>, and <code>123</code>.</li>
</ul>
</li>
<li><code><IntegerPart><strong><.></strong><NonRepeatingPart></code>
<ul>
<li>For example, <code>0.5</code>, <code>1.</code>, <code>2.12</code>, and <code>123.0001</code>.</li>
</ul>
</li>
<li><code><IntegerPart><strong><.></strong><NonRepeatingPart><strong><(></strong><RepeatingPart><strong><)></strong></code>
<ul>
<li>For example, <code>0.1(6)</code>, <code>1.(9)</code>, <code>123.00(1212)</code>.</li>
</ul>
</li>
</ul>
<p>The repeating portion of a decimal expansion is conventionally denoted within a pair of round brackets. For example:</p>
<ul>
<li><code>1/6 = 0.16666666... = 0.1(6) = 0.1666(6) = 0.166(66)</code>.</li>
</ul>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = "0.(52)", t = "0.5(25)"
<strong>Output:</strong> true
<strong>Explanation:</strong> Because "0.(52)" represents 0.52525252..., and "0.5(25)" represents 0.52525252525..... , the strings represent the same number.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> s = "0.1666(6)", t = "0.166(66)"
<strong>Output:</strong> true
</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> s = "0.9(9)", t = "1."
<strong>Output:</strong> true
<strong>Explanation:</strong> "0.9(9)" represents 0.999999999... repeated forever, which equals 1. [<a href="https://en.wikipedia.org/wiki/0.999..." target="_blank">See this link for an explanation.</a>]
"1." represents the number 1, which is formed correctly: (IntegerPart) = "1" and (NonRepeatingPart) = "".
</pre>
<p> </p>
<p><strong>Constraints:</strong></p>
<ul>
<li>Each part consists only of digits.</li>
<li>The <code><IntegerPart></code> does not have leading zeros (except for the zero itself).</li>
<li><code>1 <= <IntegerPart>.length <= 4</code></li>
<li><code>0 <= <NonRepeatingPart>.length <= 4</code></li>
<li><code>1 <= <RepeatingPart>.length <= 4</code></li>
</ul>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。