POJ 3299 Humidex 解题报告

题目连接:  http://poj.org/problem?id=3299


本题为套用公式基础题。

题目大意:有  T D H 三个数值,随机给你两个数值,由公式推断出第三个数的值

humidex = temperature + h
h = (0.5555)× (e - 10.0)
e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(dewpoint+273.16)))]
<pre name="code" class="cpp">#include"iostream"
#include"cmath"
#include"iomanip"
using namespace std;
int main()
{
	int i;
	char stype;
	double n,t,d,h;
	for(;;){
		t = d = h = 200;
		for(i = 0;i < 2;i++){
			cin >> stype >> n;
			if(stype == 'T')
				t = n;
			else if(stype == 'D')
				d = n;
			else if(stype ==  'H')
				h = n;
			else 
				return 0;
		}
		if(t == 200)//exp 是e 的 x 次方  
			t = h - (0.555) * (6.11 * exp(5417.7530 * ((1 / 273.16) - (1 / (d + 273.16)))) - 10.0);
		else if(d == 200)//log 是以 e 为底的对数
			d = 1 / ((1 / 273.16) - ((log((((h - t) / 0.5555) + 10.0) / 6.11)) / 5417.7530)) - 273.16;  
		else
			h = t + 0.5555 * (6.11 * exp(5417.7530 * ((1 / 273.16) - (1 / (d + 273.16)))) - 10.0);
		cout << setprecision(1) << fixed << "T " << t << " D " << d << " H " << h << endl;
	}
	return 0;

}



                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值