POJ 3299 水

水题。。模拟公式

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 .


#include "stdio.h"
#include "string.h"
#include "math.h"
int main()
{
	double hh,t,e,h,a,b,d;
	char ch1,ch2;

	while (scanf("%c",&ch1)!=EOF)
	{
		if (ch1=='E') break;
		scanf("%lf %c %lf",&a,&ch2,&b);
		getchar();

		if ( (ch1=='T' || ch1=='D') && (ch2=='T' || ch2=='D') )
		{
			if (ch1=='T') { t=a; d=b;}
			else {t=b; d=a;}
			e=6.11*pow(2.718281828,(5417.7530*((1/273.16)-(1/(d+273.16)))));
			h=(0.5555)*(e-10.0)+t;
			printf("T %.1lf D %.1lf H %.1lf\n",t,d,h);
		}

		if ( (ch1=='T' || ch1=='H') && (ch2=='T' || ch2=='H') )
		{
			if (ch1=='T') { t=a; h=b;}
			else { t=b; h=a;}
			e=(h-t)/0.5555+10.0;
			e/=6.11;
			e=log(e);
			e/=5417.7530;
			e=1/273.16-e;
			d=1/e;
			d-=273.16;

			printf("T %.1lf D %.1lf H %.1lf\n",t,d,h);
		}

		if ( (ch1=='H' || ch1=='D') && (ch2=='H' || ch2=='D') )
		{
			if (ch1=='H') {h=a; d=b;}
			else {h=b; d=a;}

			e=6.11*pow(2.718281828,(5417.7530*((1/273.16)-(1/(d+273.16)))));
			hh=(0.5555)*(e-10.0);
			t=h-hh;
			printf("T %.1lf D %.1lf H %.1lf\n",t,d,h);
		}







	}
	return 0;


    
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值