POJ 3299-Humidex-溼度溫度露點
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 18775 | Accepted: 6782 |
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
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 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
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');//斷言
}
相關文章
- 溫溼度計算露點函式函式
- 【.NET 與樹莓派】溫度/溼度感測器——SHT30樹莓派
- DHT11溫溼度感測器原理剖析
- W5500上傳溫溼度到oneNET平臺
- 樹莓派+串列埠墨水電子螢幕+溫度溼度感測器打造專屬時鐘樹莓派串列埠
- 基於SPI的0.96OLED資料顯示溫溼度
- 小米溫溼度感測器釋出:自動開空調
- 2022年寫的香橙派 OrangePi Zero 用python獲取dht11溫度和溼度Python
- 51微控制器彙編程式,溫溼度報警專案
- STM32之IIC通訊-SHT30溫溼度採集
- 溫度轉換
- 使用樹莓派3b+和DHT11監控溫溼度。樹莓派
- 基於arduino uno的DHT11溫溼度感測器的使用UI
- 739. 每日溫度
- 軟體工程師樹莓派獲取室內溫溼度的坎坷之旅軟體工程工程師樹莓派
- STM32 模組篇-溫溼度感測器模組(DHT11)實驗
- 使用 Arduino 和 LM35 溫度感測器監測溫度UI
- win10怎樣降低溫度_Win10電腦溫度過高怎麼降溫Win10
- 如何保持最佳 MacBook 溫度?Mac
- LoRa無線閘道器在工業溫溼度遠端監測的應用
- (一) 溫度轉換問題
- STM32基於I2C協議的AHT20溫溼度測量協議
- Air780E篇:採集溫溼度感測器資料,併網頁檢視AI網頁
- 計算風寒溼度(要求風速必須>=2,華氏度在-58度至41度之間)
- win10gpu溫度怎樣檢視_win10檢視gpu溫度步驟Win10GPU
- 筆記本cpu溫度多少正常 筆記本cpu溫度過高怎麼解決筆記
- 10寸寬溫寬壓工作加固式多功能平板電腦 ,最低工作溫度可到-20℃,最高工作溫度可到60℃
- 如何快速檢視 Mac 的溫度Mac
- Micropython TPYBoard v102 溫溼度簡訊通知器(基於SIM900A模組)Python
- 數字技術變革:廣度、深度和溫度
- win10 cpu溫度監控怎麼用_如何使用win10 cpu溫度監控Win10
- win10自帶cpu溫度怎麼檢視_win10檢視cpu溫度的方法Win10
- TG Pro for Mac(溫度監控軟體)Mac
- torch神經網路溫度預測神經網路
- 【MTK/Chargeing/Charger/驅動/JEITA】新增電池節點改變電池溫度
- ESP8266模組上傳溫溼度感測器的資料到雲平臺(樂為物聯)
- win10系統cpu溫度高怎麼辦 w10系統cpu溫度超高如何處理Win10
- mac電腦怎麼檢視cpu溫度?Mac