POJ 3299-Humidex-湿度温度露点
来源:互联网 发布:如何查看淘宝店铺电话 编辑:程序博客网 时间:2024/04/27 20:28
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
T number D number H numberwhere 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
Source
#include <iostream>#include <stdio.h>#include <cmath>//#include <assert.h>using namespace std;char a,b;double m,n,temp,hum,dew;double dohum(double t,double d){ double e=6.11*exp(5417.7530*((1/273.16)-(1/(d+273.16)))); double h=(0.5555)*(e-10.0); return t+h;}double dotemp(){ double e=6.11*exp(5417.7530*((1/273.16)-(1/(dew+273.16)))); double h=(0.5555)*(e-10.0); return hum-h;}double dodew()//逐步递推{ double x=0,delta=100; for(delta=100;delta>.00001;delta*=.5) { if(dohum(temp,x)>hum) x-=delta; else x+=delta; } return x;}int main(){ while (4==scanf(" %c %lf %c %lf",&a,&m,&b,&n)) { if(a=='E') return 0; temp=hum=dew=-99999; if(a=='T') temp=m; if(a=='H') hum=m; if(a=='D') dew=m; if(b=='T') temp=n; if(b=='H') hum=n; if(b=='D') dew=n; if(hum==-99999) hum=dohum(temp,dew); if(dew==-99999) dew=dodew(); if(temp==-99999) temp=dotemp(); printf("T %0.1lf D %0.1lf H %0.1lf\n",temp,dew,hum); } return 0; //assert(a=='E');//断言}
- POJ 3299-Humidex-湿度温度露点
- 露点、湿度换算软件
- POJ 3299 Humidex
- poj 3299 Humidex
- POJ 3299 Humidex 杂题
- POJ 3299 Humidex
- poj 3299 Humidex
- poj 3299 Humidex lightblueme
- POJ---3299 Humidex
- POJ 3299 Humidex
- poj 3299 Humidex
- POJ 3299 Humidex
- POJ 3299 - Humidex
- POJ 3299 Humidex
- Poj 3299 Humidex
- poj 3299 Humidex
- POJ - 3299 Humidex
- POJ----- 3299 Humidex
- 第11章:普通的登录功能
- 【线段树】 HDOJ 5361 In Touch
- iOS 设置NavigationBar和BarButtonItem的主题样式(iOS 6和iOS7适配)
- C++(16)STL实践与分析之初探算法
- java容器类---LinkedList
- POJ 3299-Humidex-湿度温度露点
- 深入浅出SQL Server中的死锁
- HDU 1863 畅通工程 prim算法 最小生成树
- 九度oj 1120
- C++(17)STL实践与分析之再谈迭代器
- ,HashMap和Hashtable及HashSet的区别
- STL(set_pair)运用 CF#Pi D. One-Dimensional Battle Ships
- jQuery.extend( object ); 扩展jQuery对象本身
- HDU 1201 18岁生日