F - Humidex(1.4.2)

Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d
& %I64u

Submit Status

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
#include <iostream>
#include<cmath>
#include<iomanip>
using namespace std;
char a,b;
double A,B,temp,hum,dew;
double srzs(double tt,double dd)
{ double e = 6.11 * exp (5417.7530 * ((1/273.16) - (1/(dd+273.16))));
   double h = (0.5555)*(e - 10.0);
   return tt + h;
}
double wd()
{
	 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 ld()
{
	double x = 0;
   double delta=100;
   for (delta=100;delta>.00001;delta *=.5) {
      if (srzs(temp,x)>hum) x -= delta;
      else x += delta;
   }
   return x;
}
int main()
{
	while (cin>>a&&a!='E')
	{
		dew=hum=temp=-99999;
	cin>>A>>b>>B;
	switch(a)
	{case 'T':temp = A; break;
	case 'D':dew = A; break;
	case 'H':hum = A; break;
	}
	switch(b)
	{case 'T':temp=B;break;
	case 'D':dew=B;break;
	case 'H':hum=B;break;}
if(hum==-99999)
hum =srzs(temp,dew);
if(dew==-99999)
dew=ld();
if(temp==-99999)
temp=wd();
cout<<fixed<<setprecision(1)<<"T "<<temp<<" D "<<dew<<" H "<<hum<<endl;
	}
return 0;
}

F - Humidex(1.4.2),布布扣,bubuko.com

时间: 2024-12-13 20:52:55

F - Humidex(1.4.2)的相关文章

过分过分进货价获国家

http://f.dangdang.com/group/24554/3491082/http://f.dangdang.com/group/24554/3491087/http://f.dangdang.com/group/24554/3491094/http://f.dangdang.com/group/24554/3491099/http://f.dangdang.com/group/24554/3491105/http://f.dangdang.com/group/24554/349111

我们找个地方看好戏

http://v.qq.com/page/f/y/4/m041433ssun.html http://v.qq.com/page/f/y/4/m041433ssun.html http://v.qq.com/page/f/y/4/m04143o3lhg.html http://v.qq.com/page/f/y/4/m04144675h3.html http://v.qq.com/page/f/y/4/m04144k1k1j.html http://v.qq.com/page/f/y/4/m04

poj3299 Humidex

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

3299 Humidex

Humidex Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23219   Accepted: 8264 Description Adapted from Wikipedia, the free encyclopedia The humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat

bat中for /f 如何截取任意行

一.概述 for命令开关有很多,/L,/F,/R.这里仅对含有/F的for进行分析,这个可能是最常用的,也是最强的命令,主要用来处理文件和一些命令的输出结果. 1.命令格式:(1).FOR /F ["options"] %%i IN (file) DO command(2).FOR /F ["options"] %%i IN ("string") DO command--注意双引号(3).FOR /F ["options"]

2017 ACM-ICPC 西安网络赛 F.Trig Function Chebyshev多项式

自己太菜,数学基础太差,这场比赛做的很糟糕.本来想吐槽出题人怎么都出很数学的题,现在回过头来想还是因为自己太垃圾,竞赛就是要多了解点东西. 找$f(cos(x))=cos(nx)$中$x^m$的系数模998244353. wolfram alpha查了这个函数无果,得到了一堆sinx和cosx以及一个复指数的方程,其实应该推个几项再用数列查询查查看的,然后就会知道是Chebyshev polynomials 查WIKI直接就有通项公式了.然后就比较简单的了. 连方程都看不出来就别想着推导公式了.

tailf、tail -f、tail -F三者区别

tail -f      等同于--follow=descriptor,根据文件描述符进行追踪,当文件改名或被删除,追踪停止 tail -F     等同于--follow=name  --retry,根据文件名进行追踪,并保持重试,即该文件被删除或改名后,如果再次创建相同的文件名,会继续追踪 tailf        等同于tail -f -n 10(貌似tail -f或-F默认也是打印最后10行,然后追踪文件),与tail -f不同的是,如果文件不增长,它不会去访问磁盘文件,所以tailf特

F(x)

F(x) Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 * 1. No

求f(k)=k^k(k=1...n)的前n项和

求f(k)=k^k(k=1...n)的前n项和. 程序实现: #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> long long My_Mul_Sum(int *n)//封装了一个求k^k的前n项和的函数 { int k = 1; long long sum = 0;//定义为long long是为了防止数据较大,容易溢出 for (k = 1; k <= n; k++) { int count = 0, mul = 1;//count