POJ----- 3299 Humidex
2015-08-14 10:35
204 查看
#include<iostream> #include<iomanip> #include<cmath> using namespace std; double T_D(double T , double D) { double H, h, e, tem; tem = 5417.7530 * ((1/273.16) - (1/(D + 273.16))); e = 6.11 * pow(2.718281828, tem); h = 0.5555 * (e - 10.0); H = T + h; return H; } double T_H(double T, double H) { double D, h, e, temp; h = H - T; e = h/0.5555 + 10.0; temp = log(e/6.11) / log(2.718281828); D = 1/(1/273.16 - temp/5417.7530) - 273.16; return D; } double D_H(double D, double H) { double T, e, h, temp; temp = 5417.7530 * ((1/273.16) - (1/(D + 273.16))); e = 6.11*pow(e,temp); h = 0.5555*(e - 10.0); T = H - h; return T; } int main() { char A, B; double a, b; while(cin>>A>>a>>B>>b) { if(A == 'E') break; double c; if(A=='T'&&B=='D') { c = T_D(a,b); cout<<'T'<<' '<<fixed<<setprecision(1)<<a<<' '<<'D'<<' '<<b<<' '<<'H'<<' '<<c<<endl; } else if(A=='D'&&B=='T') { c = T_D(b,a); cout<<'T'<<' '<<fixed<<setprecision(1)<<b<<' '<<'D'<<' '<<a<<' '<<'H'<<' '<<c<<endl; } else if(A=='T'&&B=='H') { c = T_H(a,b); cout<<'T'<<' '<<fixed<<setprecision(1)<<a<<' '<<'D'<<' '<<c<<' '<<'H'<<' '<<b<<endl; } else if(A=='H'&&B=='T') { c = T_H(b,a); cout<<'T'<<' '<<fixed<<setprecision(1)<<b<<' '<<'D'<<' '<<c<<' '<<'H'<<' '<<a<<endl; } else if(A=='D'&&B=='H') { c = D_H(a,b); cout<<'T'<<' '<<fixed<<setprecision(1)<<c<<' '<<'D'<<' '<<a<<' '<<'H'<<' '<<b<<endl; } else if(A=='H'&&B=='D') { c = (b,a); cout<<'T'<<' '<<fixed<<setprecision(1)<<c<<' '<<'D'<<' '<<b<<' '<<'H'<<' '<<a<<endl; } } return 0; }
相关文章推荐
- winfrom 实现读取修改xml
- Android开源项目分类汇总
- c语言语法(三)
- HDU 4099 Revenge of Fibonacci(大数加法+字典树)
- iOS概念入门学习-C语言-字符串
- 如何在GNOME的鼠标右键菜单里添加启动终端的选项
- Codeforces Round #316 (Div. 2)570C Replacement(脑洞)
- 20.策略者模式(Stragety Pattern)
- Dll 导出 别人总结
- Wlan_station例程测试
- Xamarin.Forms之Resx
- android 检测常用的手势
- Java基础——网络编程(二)
- Ubuntu学习4_Ubuntu默认防火墙安装、启用、配置、端口、查看状态相关信息
- C++序列操作之std::partition
- poj 3468__A Simple Problem with Integers(区间求和,成段更新)
- Git教程
- printf交替使用
- ASP.NET验证控件应用实例与详解。
- HDU 2222 Keywords Search(AC自动机)