博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj3299 Humidex
阅读量:2439 次
发布时间:2019-05-10

本文共 3671 字,大约阅读时间需要 12 分钟。

Humidex
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 17719   Accepted: 6420

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 + hh = (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 15T 30.0 D 25.0E

Sample Output

T 30.0 D 15.0 H 34.0T 30.0 D 25.0 H 42.3

参考代码:

#include 
#include
#include
#include
#include
using namespace std;int main(){ char a; while (cin>>a){ double t=200,d=200,h=200,e; if (a=='E') break; else if (a=='T') cin>>t; else if (a=='D') cin>>d; else cin>>h; cin>>a; if (a=='T') cin>>t; else if (a=='D') cin>>d; else cin>>h; if(h==200) h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10); else if(t==200) t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10); else if(d==200) d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16; cout<
<
<<"T "<
<<" D "<
<<" H "<
<

转载地址:http://cfbqb.baihongyu.com/

你可能感兴趣的文章
RedHat Enterprise AS4硬盘安装步骤(转)
查看>>
全国第一个高校Linux培训考试中心建立(转)
查看>>
Linux黑客大曝光:Linux安全机密与解决方案(转)
查看>>
Gentoo Linux CD 方式全程安装过程(转)
查看>>
关于Kerberos安装的几个问题(转)
查看>>
Solaris硬盘分区简介(转)
查看>>
gcc编译器小知识FAQ(转)
查看>>
Linux下多线程编程与信号处理易疏忽的一个例子(转)
查看>>
流氓和木马结合 强行关闭你的防火墙(转)
查看>>
SUSE一纸诉状控告SCO 捍卫知识产权(转)
查看>>
debian下编译2.6.13.2内核的步骤及感受(转)
查看>>
预装正版的市场意义(转)
查看>>
创建小于16M XFree86迷你Linux系统(转)
查看>>
shell中常用的工具(转)
查看>>
使用MySQL内建复制功能来最佳化可用性(转)
查看>>
一个比较vista的vista主题for rf5.0fb(转)
查看>>
推荐一款 Linux 上比较漂亮的字体(转)
查看>>
在Linux中添加新的系统调用(转)
查看>>
Fedora Core 5.0 安装教程{下载}(转)
查看>>
把ACCESS的数据导入到Mysql中(转)
查看>>