Skip to content
Rain Hu's Workspace
Go back

[LeetCode] 2469. Convert the Temperature

Rain Hu

2469. Convert the Temperature


一、題目

You are given a non-negative floating point number rounded to two decimal places celsius, that denotes the temperature in Celsius. You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit]. Return the array ans. Answers within 10^-5 of the actual answer will be accepted. Note that:

Example 1:

Example 2:

Constraints:


二、分析

三、解題

1. Math

vector<double> convertTemperature(double celsius) {
    return {celsius+273.15, 1.8*celsius+32};
}

回目錄 Catalog


Share this post on:

Previous
[LeetCode] 2470. Number of Subarrays With LCM Equal to K
Next
[LeetCode] 446. Arithmetic Slices II - Subsequence