当前位置: 首页 > news >正文

LeetCode2469. 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:

Kelvin = Celsius + 273.15
Fahrenheit = Celsius * 1.80 + 32.00

Example 1:

Input: celsius = 36.50
Output: [309.65000,97.70000]
Explanation: Temperature at 36.50 Celsius converted in Kelvin is 309.65 and converted in Fahrenheit is 97.70.
Example 2:

Input: celsius = 122.11
Output: [395.26000,251.79800]
Explanation: Temperature at 122.11 Celsius converted in Kelvin is 395.26 and converted in Fahrenheit is 251.798.

Constraints:

0 <= celsius <= 1000

二、题解

class Solution {
public:vector<double> convertTemperature(double celsius) {return {celsius + 273.15,celsius * 1.8 + 32};}
};
http://www.lryc.cn/news/272388.html

相关文章:

  • 【ROS2】MOMO的鱼香ROS2(五)ROS2入门篇——ROS2接口与自定义
  • python c语言 代码动态检查,python c语言语法分析
  • C++ DAY6 作业
  • 华为服务器安装银河麒麟V10操作系统(IBMC安装)
  • macos下php 5.6 7.0 7.4 8.0 8.3 8.4全版本PHP开发环境安装方法
  • Chatgpt为什么像打字机逐字输出?磨洋工,防止数据库被盗
  • ubuntu 卸载桌面
  • Linux文件fd剖析
  • VMWARE ESXi存储多路径策略修改
  • 结构体详解
  • 前端开发个人简历范本(2024最新版-附模板)
  • # 编程语言简史
  • SpringMVC学习与开发(三)
  • JAVA对象、List、Map和JSON之间的相互转换
  • 图像分割-漫水填充法 floodFill
  • Python open函数详解:打开指定文件与 readline和readlines函数:按行读取文件
  • Vue 生命周期有哪些?作用是什么?
  • 《Vue3 前端构建工具》 Vue-cli 与 Vite 创建项目的插件和配置对比
  • springboot(ssm中山社区医疗综合服务平台 医疗管理系统 Java系统
  • Qt编写的exe程序上添加程序信息
  • (一)CarPlay集成开发之概述与环境篇
  • js文件上传 分片上传/断点续传/极速秒传
  • mysql 通过 binglog 恢复数据
  • 【REST2SQL】01RDB关系型数据库REST初设计
  • 图像识别原理
  • 共识算法介绍
  • Gen-AI 的知识图和分析(无需图数据库)
  • flutter 安卓使用高德插件黑屏
  • Java:表单生成excel文档 poi 通用
  • 使用Apache Commons SCXML实现状态机管理