2469. Convert the Temperature Easy
1/**
2 * [2469] Convert the Temperature
3 *
4 * You are given a non-negative floating point number rounded to two decimal places celsius, that denotes the temperature in Celsius.
5 * You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit].
6 * Return the array ans. Answers within 10^-5 of the actual answer will be accepted.
7 * Note that:
8 *
9 * Kelvin = Celsius + 273.15
10 * Fahrenheit = Celsius * 1.80 + 32.00
11 *
12 *
13 * <strong class="example">Example 1:
14 *
15 * Input: celsius = 36.50
16 * Output: [309.65000,97.70000]
17 * Explanation: Temperature at 36.50 Celsius converted in Kelvin is 309.65 and converted in Fahrenheit is 97.70.
18 *
19 * <strong class="example">Example 2:
20 *
21 * Input: celsius = 122.11
22 * Output: [395.26000,251.79800]
23 * Explanation: Temperature at 122.11 Celsius converted in Kelvin is 395.26 and converted in Fahrenheit is 251.798.
24 *
25 *
26 * Constraints:
27 *
28 * 0 <= celsius <= 1000
29 *
30 */
31pub struct Solution {}
32
33// problem: https://leetcode.com/problems/convert-the-temperature/
34// discuss: https://leetcode.com/problems/convert-the-temperature/discuss/?currentPage=1&orderBy=most_votes&query=
35
36// submission codes start here
37
38impl Solution {
39 pub fn convert_temperature(celsius: f64) -> Vec<f64> {
40 vec![]
41 }
42}
43
44// submission codes end
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn test_2469() {
52 }
53}
54
Back
© 2025 bowen.ge All Rights Reserved.