poj3299Humidex

poj3299 Humidex(公式直接算) 水题 有一丢丢技巧的输入,再带上三个个公式的计算 代码思路和格式蛮漂亮的,可以借鉴 #include<iostream> #include<cmath> #define exp 2.718281828 using namespace std; double geth(double t,double d){ double h,e; e=6.11*pow(exp,5417.7530*((1/273.16)-(1/(d+273.16)))); h=0.5555*(e-10); r 阅读详情
Humidex
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 20936 Accepted: 7519

Description

Adapted from Wikipedia, the free encyclopedia

The humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and humidity. It differs from the heat index used in the United States in using dew point rather than relative humidity.

When the temperature is 30°C (86°F) and the dew point is 15°C (59°F), the humidex is 34 (note that humidex is a dimensionless number, but that the number indicates an approximate temperature in C). If the temperature remains 30°C and the dew point rises to 25°C (77°F), the humidex rises to 42.3.

The humidex tends to be higher than the U.S. heat index at equal temperature and relative humidity.

The current formula for determining the humidex was developed by J.M. Masterton and F.A. Richardson of Canada's Atmospheric Environment Service in 1979.

According to the Meteorological Service of Canada, a humidex of at least 40 causes "great discomfort" and above 45 is "dangerous." When the humidex hits 54, heat stroke is imminent.

The record humidex in Canada occurred on June 20, 1953, when Windsor, Ontario hit 52.1. (The residents of Windsor would not have known this at the time, since the humidex had yet to be invented.) More recently, the humidex reached 50 on July 14, 1995 in both Windsor and Toronto.

The humidex formula is as follows:

humidex = temperature + h
h = (0.5555)× (e - 10.0)
e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(dewpoint+273.16)))]
where  exp(x) is 2.718281828 raised to the exponent  x.

While humidex is just a number, radio announcers often announce it as if it were the temperature, e.g. "It's 47 degrees out there ... [pause] .. with the humidex,". Sometimes weather reports give the temperature and dewpoint, or the temperature and humidex, but rarely do they report all three measurements. Write a program that, given any two of the measurements, will calculate the third.

You may assume that for all inputs, the temperature, dewpoint, and humidex are all between -100°C and 100°C.

Input

Input will consist of a number of lines. Each line except the last will consist of four items separated by spaces: a letter, a number, a second letter, and a second number. Each letter specifies the meaning of the number that follows it, and will be either T, indicating temperature, D, indicating dewpoint, or H, indicating humidex. The last line of input will consist of the single letter E.

Output

For each line of input except the last, produce one line of output. Each line of output should have the form:

T number D number H number
where the three numbers are replaced with the temperature, dewpoint, and humidex. Each value should be expressed rounded to the nearest tenth of a degree, with exactly one digit after the decimal point. All temperatures are in degrees celsius.

Sample Input

T 30 D 15
T 30.0 D 25.0
E

Sample Output

T 30.0 D 15.0 H 34.0
T 30.0 D 25.0 H 42.3
题目大意:输入T,D,H三个数中的任意两个,求第三个。
解题思路:输入有6种情况:TD,DT,HT,TH,DH,HD,这里我是用switch来判断输入的值是哪两个,然后再直接套用公式就可以了。(刚看题时以为公式那一部分会比较难处理,后来发现是我想多了。。。)
 
#include
   
    
#include
    
     
#include
     
      
float t,d,h,e,H;
char n;
int main(){
	while(scanf("%c",&n)!=EOF){
		t=50000;
		d=50000;
		h=50000;
	switch(n){
		case 'T' :scanf("%f",&t);break;
		case 'D' :scanf("%f",&d);break;
		case 'H' :scanf("%f",&h);break;
		case 'E' :return 0;
	}
	getchar();
	scanf("%c",&n);
	switch(n){
		case 'T' :scanf("%f",&t);break;
		case 'D' :scanf("%f",&d);break;
		case 'H' :scanf("%f",&h);break;
		case 'E' :return 0;
	}
	getchar();
	if(h==50000&&t!=50000&&d!=50000){
	e = 6.11*pow(2.718281828,(5417.7530*((1/273.16)-(1/(d+273.16)))));
	H=0.5555*(e-10.0);
	h=t+H;
	}
	else if(t==50000&&h!=50000&&d!=50000){
			e = 6.11*pow(2.718281828,(5417.7530*((1/273.16)-(1/(d+273.16)))));
			H=0.5555*(e-10.0);
			t=h-H;
	}
	else if(d==50000&&h!=50000&&t!=50000){
		H=h-t;
		e=(H/0.5555)+10.0;
		d=(1/(-log(e/6.11)/5417.7530+(1/273.16))-273.16);
	}
	printf("T %.1f D %.1f H %.1f\n",t,d,h);
	}
} 
     
    
   
北大POJ3299-Humidex编程题解 POJ在线判题系统中的题目涵盖范围广泛,从基础算法到复杂的数据结构设计,旨在锻炼参与者的编程思维与编码能力。这些题目不仅有助于理解理论知识,而且还培养了解决实际问题的能力。题目编号3299通常代表POJ中的一个具体编程挑战题目。这个特定的题目可能是关于算法设计、数据结构应用、数学问题、字符串处理等方面的一个具体实例。此题目旨在考察参与者对于特定编程问题的理解,以及使用计算机语言实现解决方案的能力。题目编号3299是POJ(北京大学在线评测系统)中的一个典型算法问题。 阅读详情

相关推荐

移远EC800M CAT1模块HTTP POST实战:从AT指令到数据上报的完整避坑指南

本文详细介绍了移远EC800M CAT1模块通过AT指令实现HTTP POST数据上报的完整开发流程,包括模块初始化、PDP上下文配置、HTTP POST实现及优化策略。针对实际开发中的常见问题如网络异常、低功耗需求等提供了经过验证的解决方案,帮助开发者快速实现稳定可靠的物联网数据传输功能。

weixin_42556197的博客 480

make && make install 出错

cd src && make all make[1]: Entering directory /home/leyou/redis/src' CC Makefile.dep make[1]: Leaving directory/home/leyou/redis/src’ make[1]: Entering directory /home/leyou/redis/src' rm -rf...

badboynotbad的博客 3521

GD32F303 ADC+DMA实战:用硬件过采样搞定多通道数据采集(附完整代码)

本文详细介绍了GD32F303系列MCU通过ADC+DMA结合硬件过采样技术实现多通道数据采集的实战方案。从硬件设计要点到软件配置全解析,包括时钟树配置、ADC模块初始化和DMA传输设置,提供了完整的代码示例和优化技巧,帮助工程师构建高精度、低功耗的数据采集系统。

weixin_30466039的博客 319

Linux 安装redis后没有redis-server

记录Linux安装redis遇到的一个问题 首先用wget下载好redis的jar包,版本去官网看,我这个可能不是最新版 wget http://download.redis.io/releases/redis-6.0.6.tar.gz 有些人说去官网下载jar包,然后上传到Linux,没必要,一行指令就能解决的事情。 解压 下载和解压的目录自己喜欢就好,后面可以自行移动 tar -zxvf redis-6.0.6.tar.gz 然后解压完毕后,src目录下没有redis-server启动文件,百度了一

StreamlineWq的博客 9123

时间同步中 TOD 与GPRMC和IRIG-B的区别

时间同步中 TOD 与GPRMC和IRIG-B的区别

ftdlk的博客 1726

用Stata复现经典文献:上市公司全要素生产率(TFP)计算全流程(含LP/OP代码解读)

本文提供了使用Stata软件复现上市公司全要素生产率(TFP)计算的完整实战指南。重点解读了主流的Levinsohn-Petrin(LP)和Olley-Pakes(OP)半参数估计方法,通过详细的数据清洗、变量构建与价格平减步骤,手把手演示了如何准确测算TFP,并强调了LP方法在处理中国上市公司数据时的稳定性和适用性。

b0c1d2的博客 594

poj 3299 Humidex

Humidex Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9883 Accepted: 3755 Description Adapted from Wikipedia, the free encyclopedia The humidex is a mea...

weixin_30955341的博客 305

不用加速器!Google Earth Pro登录失败自救手册:从服务器连接到地图加载的完整排错流程

本文详细解析了Google Earth Pro登录失败的常见问题及解决方案,包括服务器连接失败、地图加载异常等。通过基础排查、内置修复工具使用和高级配置调整,帮助用户无需加速器即可解决启动问题、黑屏和转圈圈等困扰,提升软件使用体验。

weixin_29227425的博客 485

Redis安装及异常解决办法

第一步: redis官网下载redis压缩包(linux环境) 第二步: 解压你的压缩包: tar xzf redis-5.0.0.tar.gz 进入你的redis文件夹: cd redis-5.0.0 编译Redis: make 安装编译好的文件: make install 第三步: 开启你的服务: src/redis-server ps:make时候可能会回到的问题: (1)make...

希望大家都会在一个进步的过程 862

台达PLC DIAdesigner-AX 编程实战:从安装到通信配置

本文详细介绍了台达PLC DIAdesigner-AX编程的实战操作,从软件安装、项目创建到通信配置的全流程。重点讲解了TCP/IP通信设置、库文件管理及常见错误处理,帮助工程师快速掌握台达PLC编程技巧,提升工业自动化项目的开发效率。

weixin_29215391的博客 530

华为OD机试:使用Ascend C语言实现Matmul与LeakyReLU融合算子的全流程设计与优化解析

通过本文的详细解析,相信你已经对华为OD机试中基于Ascend C语言的Matmul+LeakyReLU融合算子的设计与实现有了深入的理解。我们不仅从理论上探讨了融合算子的核心优势,还通过实际的代码示例演示了如何一步步完成算子的实现与优化。融合算子在AI算子开发中的应用,尤其是在处理大规模矩阵计算的场景中,能够显著提升计算效率,优化内存占用,并减少数据传输的开销。通过合理的Tiling策略设计,我们还能够充分利用多核处理器的算力,进一步提升AI模型的训练与推理性能。

qq_38334677的博客 661

Linux启动Redis失败/没有那个文件或目录

没有那个文件或目录问题,可能是你选择的目录不对。 应切换到Redis目录下启动。 转载于:https://www.cnblogs.com/java-263/p/10343919.html

weixin_30568715的博客 4233

YOLOv11改进,YOLOv11添加DCNv4可变性卷积(windows系统成功编译),二次创新C3k2结构,全网最详细教程

引入了可变形卷积 v4 (DCNv4),这是一种为广泛视觉应用设计的高效且有效的操作算子。DCNv4通过两项关键增强解决了其前身DCNv3的局限性:1. 移除空间聚合中的softmax归一化,以增强其动态特性和表达能力;2. 优化内存访问以最小化冗余操作,从而加速计算。这些改进使得DCNv4相比DCNv3显著加快了收敛速度,并且处理速度大幅提升,前向传播速度超过三倍。DCNv4在多个任务中表现出色,包括图像分类、实例和语义分割,特别是在图像生成方面表现突出。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 2665

程序证明与形式化验证:从理论到工程实践

程序证明作为计算机科学的重要分支,旨在通过数学方法确保软件行为的绝对正确性。其核心原理是形式化验证,即使用形式化语言对系统进行精确描述,并通过逻辑推理证明其满足特定属性。这项技术的价值在于能够提供超越传统测试的逻辑完备性保证,从根本上提升软件的可信度。在工程实践中,形式化验证已应用于安全关键系统、密码学实现、操作系统内核等场景,通过自动化工具链(如SMT求解器)降低验证负担。例如,Project Everest项目采用分层验证策略,聚焦于构建完全形式化验证的HTTPS协议栈,为互联网安全通信打造数学意义上的

weixin_30325971的博客 360

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

POJ 3299 Humidex Java题解

本文主要是针对POJ-3299-Humidex使用Java实现的相关过程,以及初学者的注意事项。

Exticntion的博客 749

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

POJ3299 -- Humidex

POJ3299 -- Humidex Submit1:Wrong Answer #include #include int main(){ char flag; double temperature,dew_point; while(scanf("%c",&flag)!=EOF&&flag!='E'){ scanf(" %lf D %lf",&t

360

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

POJ3299 Humidex

//1_4_2: Humidex 湿热指数,温度和露点之间的关系 POJ3299 #include #include #include #include using namespace std; double get_hum(double tem,double dew) { return tem + 0.5555 * (6.11 * exp(5417.7530 * ((1 / 273.1

364

POJ3299-Humidex

转载:http://blog.youkuaiyun.com/lyy289065406/article/details/6642582 POJ3299-Humidex 提示:纯粹的数学公式,连推导公式都可以省了= = //Memory   Time    //240K      0MS       #include   #include   #include

saishangxue123的专栏 405

POJ 刷题系列:3299. Humidex

POJ 刷题系列:3299. Humidex传送门:POJ 3299. Humidex题意: 给定T, D, H中的任意两个数,求另外一个。 思路: 公式由题目给定,如下: humidex = temperature + h h = (0.5555)× (e - 10.0) e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(dewpoi

Demon-初来驾到 1626

POJ 3299 Humidex

Adapted fromWikipedia, the free encyclopedia The humidex is ameasurement used by Canadian meteorologists to reflect the combined effect ofheat and humidity. It differs from the heat index used in the

emoheithree的博客 428

POJ - 3299 Humidex

Humidex Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit Status Description Adapted from Wikipedia, the free encyclopedia The humidex

acm_1361677193的专栏 351

Poj 3299 Humidex

1.链接: http://poj.org/problem?id=3299 2.题目: Humidex Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16705   Accepted: 6078 Description Adapted from Wikip

西门求雪的专栏 383

POJ 3299.Humidex

题目:http://poj.org/problem?id=3299 AC代码(C++): #include #include #include #include #include #include #include #include #include using namespace std; int main(){ double t; double d;

njyexiong的博客 299

Poj3299——Humidex

题目 T he humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and humidity. It differs from the heat index used in the United States in using dew point rath...

qq_42770849的博客 406
上一篇: poj2046 Power Strings(KMP)
下一篇: poj2676Sudoku(DFS)
luckcircle
博客等级 码龄10年 13粉丝 50原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值