poj3299 - Humidex
2017-08-31 19:08:25
writer:pprp
水题:
没有技术含量hhh
但是,还是花了很长时间,以后水题也是很有必要练习的
- /*
- @theme:poj 3299
- @writer:pprp
- @declare:刷poj上的题,水题要提高速度,还有理解题意的能力
- @date:2017/8/31
- */
- #include <iostream>
- #include <cstdio>
- #include <cmath>
- #include <cstring>
- using namespace std;
- const double e = 2.718281828;
- const double tmp = 273.16;
- const double tmp2 = 5417.7530;
- const double tmp3 = 0.5555;
- //求humidex
- //test:ok
- double fun1(double t, double d)
- {
- double e = 6.11 * exp(tmp2*((/tmp) - (/(d+tmp))));
- double h = tmp3 * (e - 10.0);
- return t + h;
- }
- //求temperature
- //test:
- double fun2(double h, double d)
- {
- double e = 6.11 * exp(tmp2*((/tmp) - (/(d+tmp))));
- double h2 = tmp3 * (e - 10.0);
- return h - h2;
- }
- //求dew point
- //test:
- double fun3(double h, double t)
- {
- double h2 = h - t;
- double e = h2/tmp3 + 10.0;
- return 1.0/(1.0/tmp -((log(e)-log(6.11))/tmp2)) - tmp;
- }
- /*
- int main()
- {
- double t , d;
- cin >> t >> d;
- printf("%.1f",fun1(t,d));
- return 0;
- }
- */
- int main()
- {
- //freopen("in.txt","r",stdin);
- char A, B;
- double a = , b = ;
- char buff[];
- while(gets(buff) && strcmp(buff,"E") != )
- {
- sscanf(buff,"%c %lf %c %lf",&A, &a, &B, &b);
- // cout << A << endl;
- // cout << a << endl;
- // cout << B << endl;
- // cout << b << endl;
- if(A == 'T')
- {
- if(B == 'D')
- {
- // cout << "tag" << endl;
- printf("T %.1f D %.1f H %.1f\n",a,b,fun1(a,b));
- }
- else if(B == 'H')
- {
- printf("T %.1f D %.1f H %.1f\n",a,fun3(b,a),b);
- }
- }
- else if(A == 'D')
- {
- if(B == 'H')
- {
- printf("T %.1f D %.1f H %.1f\n",fun2(b,a),a,b);
- }
- else if(B == 'T')
- {
- printf("T %.1f D %.1f H %.1f\n",b,a,fun1(b,a));
- }
- }
- else if(A == 'H')
- {
- if(B == 'T')
- {
- printf("T %.1f D %.1f H %.1f\n",b,fun3(a,b),a);
- }
- else if(B == 'D')
- {
- printf("T %.1f D %.1f H %.1f\n",fun2(a,b),b,a);
- }
- }
- }
- return ;
- }
注意:double型的要用lf否则就会出错
poj3299 - Humidex的更多相关文章
- 【POJ3299】Humidex(简单的数学推导)
公式题中已经给出,直接求解即可. #include <iostream> #include <cstdlib> #include <cstdio> #include ...
- poj3299
...
- F - Humidex(1.4.2)
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Descr ...
- 3299 Humidex
Humidex Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 23219 Accepted: 8264 Descript ...
- POJ 3299 Humidex 难度:0
题目链接:http://poj.org/problem?id=3299 #include <iostream> #include <iomanip> using namespa ...
- poj 3299 Humidex
直接套公式就可以,可我套公式第一遍都错了,英语差的孩子伤不起(┬_┬) #include <iostream> #include <cmath> #include <io ...
- POJ 3299 Humidex(简单的问题)
[简要题意]:什么是温度,湿度--,之间的转换.. [分析]:式已被赋予. // 252k 0Ms /* 当中exp表示的是求e的x次幂 解法就直接依据题目中的公式解决就好!! */ #include ...
- Humidex POJ - 3299 (数学)
题目大意 给定你三个变量中的两个输出剩下的那一个 题解 没有什么,就是把公式推出来即可,完全的数学题 代码 #include <iostream> #include <cmath&g ...
- 【转】POJ题目分类推荐 (很好很有层次感)
OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期: 一. ...
随机推荐
- rabbitmq延迟队列相关
https://blog.csdn.net/qq_26656329/article/details/77891793 --------------rabbitmq queue_decla ...
- URL地址中的字符串转换
url出现了有+,空格,/,?,%,#,&,=等特殊符号的时候,可能在服务器端无法获得正确的参数值,怎么解决?解决办法将这些字符转化成服务器可以识别的字符,对应关系如下:URL字符转义 用其它 ...
- 14.Iterate a Cursor in the mongo Shell-官方文档摘录
1 迭代游标 } ); while (myCursor.hasNext()) { print(tojson(myCursor.next())); } } ); myCursor.forEach(pri ...
- struts2之Action获取请求参数与web元素
文章思路清晰 http://blog.csdn.net/zeqblog/article/details/8665052
- 关于理财和买房 http://shouce.jb51.net/phpcms/ https://www.bj.cmbchina.com/bjtransweb/wsgzd_employ/login.jsp
对于绝大多数家境普通的年轻人来说,青年阶段无疑是一生中手头最紧的时候.原因很简单,这个阶段花钱最多,挣钱却最少.年轻人收入往往是硬性的低,开支却往往是硬性 的高.已经加班到晕头转向的小职员,很难再 ...
- 1130 - Host '' is not allowerd to connect to this MySQL server,
是因为缺少访问权限,在MySQL ->User表里 执行 INSERT INTO `user` VALUES ('%', 'root', '*81F5E21E35407D884A6CD4A731 ...
- H5移动端的一些坑、、、
H5项目常见问题及注意事项 Meta基础知识: H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 //一.HTML页面结构 <meta name="viewport" co ...
- 有按钮的ListView
有按钮的ListView 但是有时候,列表不光会用来做显示用,我们同样可以在在上面添加按钮.添加按钮首先要写一个有按钮的xml文件,然后自然会想到用上面的方法定义一个适配器,然后将数据映射到布局文件上 ...
- es6函数模块-------初步学习
初步学习: 函数参数允许尾逗号 function clownsEverywhere( param1, param2, //param2后面有逗号 ) { } 函数参数可以赋初值 利用解构赋值默认值结合 ...
- 42. Trapping Rain Water(直方图 存水量 hard)
Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...