POJ 3299 Humidex

完全的水题,题目繁多,不必去理解,只需要推导公式即可。
具体可以看讨论:

http://www.cppleyuan.com/viewthread.php?tid=917&extra=page%3D1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 #include <iostream>
#include <cmath>
using namespace std;
 
const double e = 2.718281828;
 
double fun1(double h, double d)//求T
{
 return h - (0.5555 * ((6.11 * pow(e, 5417.7530*(1/273.16-1/(d+273.16)))) - 10.0));
}
 
double fun2(double t, double d)//求H
{
    return t + (0.5555 * ((6.11*pow(e,5417.7530*(1/273.16-1/(d+273.16)))) - 10.0));
}
 
double fun3(double t, double h)//求D
{
    return 1/(1/273.16 - log(((h-t)/0.5555+10.0)/6.11)/5417.7530) - 273.16;
}
 
int main()
{
    char a1,a2;
    double t1,t2;
    while(scanf("%c", &a1) && a1 != 'E')
    {
		scanf("%lf %c %lf", &t1, &a2, &t2);
		//printf("%c %lf %c %lf\n", a1, t1, a2, t2);
        //输出
        //数据前后顺序,如T 30 D 15和D 15 T 30答案应该一样
        if(a1=='D'&&a2=='H')
			printf("T %.1f D %.1f H %.1f\n",fun1(t2,t1),t1,t2);
        else if(a1=='H'&&a2=='D')
            printf("T %.1f D %.1f H %.1f\n",fun1(t1,t2),t2,t1);
		else if(a1=='T'&&a2=='D')
			printf("T %.1f D %.1f H %.1f\n",t1,t2,fun2(t1,t2));
        else if(a1=='D'&&a2=='T')
			printf("T %.1f D %.1f H %.1f\n",t2,t1,fun2(t2,t1));
        else if(a1=='T'&&a2=='H')
			printf("T %.1f D %.1f H %.1f\n",t1,fun3(t1,t2),t2);
		else if(a1=='H'&&a2=='T')
			printf("T %.1f D %.1f H %.1f\n",t2,fun3(t2,t1),t1);   
	}
	return 0;
}

发布者

Tanky Woo

Tanky Woo,[个人主页:https://tankywoo.com] / [新博客:https://blog.tankywoo.com]

发表评论

电子邮件地址不会被公开。 必填项已用*标注