mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
36 lines
1.4 KiB
HTML
36 lines
1.4 KiB
HTML
<p>给你一个四舍五入到两位小数的非负浮点数 <code>celsius</code> 来表示温度,以 <strong>摄氏度</strong>(<strong>Celsius</strong>)为单位。</p>
|
||
|
||
<p>你需要将摄氏度转换为 <strong>开氏度</strong>(<strong>Kelvin</strong>)和 <strong>华氏度</strong>(<strong>Fahrenheit</strong>),并以数组 <code>ans = [kelvin, fahrenheit]</code> 的形式返回结果。</p>
|
||
|
||
<p>返回数组<em> <code>ans</code></em> 。与实际答案误差不超过 <code>10<sup>-5</sup></code> 的会视为正确答案<strong>。</strong></p>
|
||
|
||
<p><strong>注意:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>开氏度 = 摄氏度 + 273.15</code></li>
|
||
<li><code>华氏度 = 摄氏度 * 1.80 + 32.00</code></li>
|
||
</ul>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1 :</strong></p>
|
||
|
||
<pre><strong>输入:</strong>celsius = 36.50
|
||
<strong>输出:</strong>[309.65000,97.70000]
|
||
<strong>解释:</strong>36.50 摄氏度:转换为开氏度是 309.65 ,转换为华氏度是 97.70 。</pre>
|
||
|
||
<p><strong>示例 2 :</strong></p>
|
||
|
||
<pre><strong>输入:</strong>celsius = 122.11
|
||
<strong>输出:</strong>[395.26000,251.79800]
|
||
<strong>解释:</strong>122.11 摄氏度:转换为开氏度是 395.26 ,转换为华氏度是 251.798 。
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>0 <= celsius <= 1000</code></li>
|
||
</ul>
|