【POJ3299】Humidex(简单的数学推导)
公式题中已经给出,直接求解即可。
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <map>
#include <iomanip>
using namespace std; map<char, double> data; int main () {
ios :: sync_with_stdio (false);
char C1, C2;
double X1, X2;
while (cin >> C1) {
if (C1 == 'E') break;
cin >> X1 >> C2 >> X2;
data[C1] = X1; data[C2] = X2;
if ( (C1 == 'T' && C2 == 'H') || (C1 == 'H' && C2 == 'T') ) {
double h = data['H'] - data['T'];
double e = h / 0.5555 + 10.0;
double ln_ = log (e / 6.11);
data['D'] = 1.0 / (1.0 / 273.16 - ln_ / 5417.7536) - 273.16;
}
else { double e = 6.11 * exp (5417.7530 * (1.0 / 273.16 - (1.0 / (data['D'] + 273.16))));
//cout << "e = " << e << endl;
double h = (0.5555) * (e - 10.0);
//cout << "h = " << h << endl;
if ((C1 == 'T' && C2 == 'D' ) || (C1 == 'D' && C2 == 'T')) {
//cout << "T D -> H" << endl;
data['H'] = data['T'] + h;
}
if ((C1 == 'H' && C2 == 'D' ) || (C1 == 'D' && C2 == 'H')) {
//cout << "H D -> T" << endl;
data['T'] = data['H'] - h;
}
}
printf ("T %.1f D %.1f H %.1f\n", data['T'], data['D'], data['H']);
}
return ;
}
【POJ3299】Humidex(简单的数学推导)的更多相关文章
- 关于不同进制数之间转换的数学推导【Written By KillerLegend】
关于不同进制数之间转换的数学推导 涉及范围:正整数范围内二进制(Binary),八进制(Octonary),十进制(Decimal),十六进制(hexadecimal)之间的转换 数的进制有多种,比如 ...
- 『sumdiv 数学推导 分治』
sumdiv(POJ 1845) Description 给定两个自然数A和B,S为A^B的所有正整数约数和,编程输出S mod 9901的结果. Input Format 只有一行,两个用空格隔开的 ...
- 借One-Class-SVM回顾SMO在SVM中的数学推导--记录毕业论文5
上篇记录了一些决策树算法,这篇是借OC-SVM填回SMO在SVM中的数学推导这个坑. 参考文献: http://research.microsoft.com/pubs/69644/tr-98-14.p ...
- css3 calc():css简单的数学运算-加减乘除
css3 calc():css简单的数学运算–加减乘除 多好的东西啊,不用js,一个css就解决了. .box{ border:1px solid #ddd; width:calc(100% - 10 ...
- UVA - 10014 - Simple calculations (经典的数学推导题!!)
UVA - 10014 Simple calculations Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & ...
- LDA-线性判别分析(二)Two-classes 情形的数学推导
本来是要调研 Latent Dirichlet Allocation 的那个 LDA 的, 没想到查到很多关于 Linear Discriminant Analysis 这个 LDA 的资料.初步看了 ...
- leetcode 343. Integer Break(dp或数学推导)
Given a positive integer n, break it into the sum of at least two positive integers and maximize the ...
- [hdu5307] He is Flying [FFT+数学推导]
题面 传送门 思路 看到这道题,我的第一想法是前缀和瞎搞,说不定能$O\left(n\right)$? 事实证明我的确是瞎扯...... 题目中的提示 这道题的数据中告诉了我们: $sum\left( ...
- ZOJ3329(数学推导+期望递推)
要点: 1.期望的套路,要求n以上的期望,则设dp[i]为i分距离终点的期望步数,则终点dp值为0,答案是dp[0]. 2.此题主要在于数学推导,一方面是要写出dp[i] = 什么,虽然一大串但是思维 ...
随机推荐
- jquery href属性和click事件冲突
a标签的定义如下: <a href="javascript:void(0);">test</a> jquery中的click事件: $("a&qu ...
- poj 2566 Bound Found(尺取法 好题)
Description Signals of most probably extra-terrestrial origin have been received and digitalized by ...
- 获取java类和方法名
String clazz = this.getClass().getName(); String method = Thread.currentThread() .getStackTrace()[1] ...
- [Angular 2] Using events and refs
This lesson shows you how set listen for click events using the (click) syntax. It also covers getti ...
- 使用Qt Style Sheets制作UI特效
引言 作为一套GUI框架,Qt是非常强大的.(注:Qt 不仅是一套优秀的GUI框架,同时也是一套出色的应用程序框架).在UI的制作方面Qt为广大开发者提供了一套强大而易用的工具,她就是——Qt Sty ...
- C#调用C++的DLL 数据类型转换
/C++中的DLL函数原型为 //extern "C" __declspec(dllexport) bool 方法名一(const char* 变量名1, unsig ...
- Emacs显示行号
在配置.emacs文件中加上 (global-linum-mode t) 启动emacs后按 m-x global-linum-mode 就可以显示行号,但是每次打开emacs,要重新 ...
- 阿里云Centos7使用yum安装MySQL5.6的正确姿势
阿里云Centos7使用yum安装MySQL5.6 阿里云Centos7使用yum安装MySQL5.6 前言:由于某些不可抗力,我要在自己的阿里云服务器上搭建hadoop+hive+mysql+tom ...
- show,hide与fadeIn、fadeOu的区别
show,hide——>是通过改变height,width,opacity来实现动画的显示与隐藏的 fadeIn.fadeOut——>只通过opacity来实现动画的显示与隐藏的 它们两个 ...
- JavaScript可否多线程? 深入理解JavaScript定时机制(转载)
说明:最近写 js 时需要用setinterval函数做定时操作,谁知道,刚开始后运行完好,但一段时间后他就抽风了,定时任务运行的时间间隔越来越短,频率加快,这是一个完全不能容忍的问题,带着一个可以出 ...