2017-08-31 19:08:25

writer:pprp

水题:

没有技术含量hhh

但是,还是花了很长时间,以后水题也是很有必要练习的

  1. /*
  2. @theme:poj 3299
  3. @writer:pprp
  4. @declare:刷poj上的题,水题要提高速度,还有理解题意的能力
  5. @date:2017/8/31
  6. */
  7.  
  8. #include <iostream>
  9. #include <cstdio>
  10. #include <cmath>
  11. #include <cstring>
  12.  
  13. using namespace std;
  14.  
  15. const double e = 2.718281828;
  16. const double tmp = 273.16;
  17. const double tmp2 = 5417.7530;
  18. const double tmp3 = 0.5555;
  19.  
  20. //求humidex
  21. //test:ok
  22. double fun1(double t, double d)
  23. {
  24.  
  25. double e = 6.11 * exp(tmp2*((/tmp) - (/(d+tmp))));
  26. double h = tmp3 * (e - 10.0);
  27. return t + h;
  28. }
  29. //求temperature
  30. //test:
  31. double fun2(double h, double d)
  32. {
  33. double e = 6.11 * exp(tmp2*((/tmp) - (/(d+tmp))));
  34. double h2 = tmp3 * (e - 10.0);
  35. return h - h2;
  36. }
  37. //求dew point
  38. //test:
  39. double fun3(double h, double t)
  40. {
  41. double h2 = h - t;
  42. double e = h2/tmp3 + 10.0;
  43. return 1.0/(1.0/tmp -((log(e)-log(6.11))/tmp2)) - tmp;
  44. }
  45. /*
  46. int main()
  47. {
  48. double t , d;
  49. cin >> t >> d;
  50. printf("%.1f",fun1(t,d));
  51.  
  52. return 0;
  53. }
  54. */
  55.  
  56. int main()
  57. {
  58.  
  59. //freopen("in.txt","r",stdin);
  60. char A, B;
  61. double a = , b = ;
  62. char buff[];
  63. while(gets(buff) && strcmp(buff,"E") != )
  64. {
  65. sscanf(buff,"%c %lf %c %lf",&A, &a, &B, &b);
  66. // cout << A << endl;
  67. // cout << a << endl;
  68. // cout << B << endl;
  69. // cout << b << endl;
  70. if(A == 'T')
  71. {
  72. if(B == 'D')
  73. {
  74. // cout << "tag" << endl;
  75. printf("T %.1f D %.1f H %.1f\n",a,b,fun1(a,b));
  76. }
  77. else if(B == 'H')
  78. {
  79. printf("T %.1f D %.1f H %.1f\n",a,fun3(b,a),b);
  80. }
  81.  
  82. }
  83. else if(A == 'D')
  84. {
  85. if(B == 'H')
  86. {
  87. printf("T %.1f D %.1f H %.1f\n",fun2(b,a),a,b);
  88. }
  89. else if(B == 'T')
  90. {
  91. printf("T %.1f D %.1f H %.1f\n",b,a,fun1(b,a));
  92. }
  93.  
  94. }
  95. else if(A == 'H')
  96. {
  97. if(B == 'T')
  98. {
  99. printf("T %.1f D %.1f H %.1f\n",b,fun3(a,b),a);
  100. }
  101. else if(B == 'D')
  102. {
  103. printf("T %.1f D %.1f H %.1f\n",fun2(a,b),b,a);
  104. }
  105. }
  106.  
  107. }
  108.  
  109. return ;
  110. }

注意:double型的要用lf否则就会出错

poj3299 - Humidex的更多相关文章

  1. 【POJ3299】Humidex(简单的数学推导)

    公式题中已经给出,直接求解即可. #include <iostream> #include <cstdlib> #include <cstdio> #include ...

  2. poj3299

                                                                                                         ...

  3. F - Humidex(1.4.2)

    Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Descr ...

  4. 3299 Humidex

    Humidex Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23219   Accepted: 8264 Descript ...

  5. POJ 3299 Humidex 难度:0

    题目链接:http://poj.org/problem?id=3299 #include <iostream> #include <iomanip> using namespa ...

  6. poj 3299 Humidex

    直接套公式就可以,可我套公式第一遍都错了,英语差的孩子伤不起(┬_┬) #include <iostream> #include <cmath> #include <io ...

  7. POJ 3299 Humidex(简单的问题)

    [简要题意]:什么是温度,湿度--,之间的转换.. [分析]:式已被赋予. // 252k 0Ms /* 当中exp表示的是求e的x次幂 解法就直接依据题目中的公式解决就好!! */ #include ...

  8. Humidex POJ - 3299 (数学)

    题目大意 给定你三个变量中的两个输出剩下的那一个 题解 没有什么,就是把公式推出来即可,完全的数学题 代码 #include <iostream> #include <cmath&g ...

  9. 【转】POJ题目分类推荐 (很好很有层次感)

    OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期: 一. ...

随机推荐

  1. rabbitmq延迟队列相关

    https://blog.csdn.net/qq_26656329/article/details/77891793        --------------rabbitmq queue_decla ...

  2. URL地址中的字符串转换

    url出现了有+,空格,/,?,%,#,&,=等特殊符号的时候,可能在服务器端无法获得正确的参数值,怎么解决?解决办法将这些字符转化成服务器可以识别的字符,对应关系如下:URL字符转义 用其它 ...

  3. 14.Iterate a Cursor in the mongo Shell-官方文档摘录

    1 迭代游标 } ); while (myCursor.hasNext()) { print(tojson(myCursor.next())); } } ); myCursor.forEach(pri ...

  4. struts2之Action获取请求参数与web元素

    文章思路清晰 http://blog.csdn.net/zeqblog/article/details/8665052

  5. 关于理财和买房 http://shouce.jb51.net/phpcms/ https://www.bj.cmbchina.com/bjtransweb/wsgzd_employ/login.jsp

    对于绝大多数家境普通的年轻人来说,青年阶段无疑是一生中手头最紧的时候.原因很简单,这个阶段花钱最多,挣钱却最少.年轻人收入往往是硬性的低,开支却往往是硬性   的高.已经加班到晕头转向的小职员,很难再 ...

  6. 1130 - Host '' is not allowerd to connect to this MySQL server,

    是因为缺少访问权限,在MySQL ->User表里 执行 INSERT INTO `user` VALUES ('%', 'root', '*81F5E21E35407D884A6CD4A731 ...

  7. H5移动端的一些坑、、、

    H5项目常见问题及注意事项 Meta基础知识: H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 //一.HTML页面结构 <meta name="viewport" co ...

  8. 有按钮的ListView

    有按钮的ListView 但是有时候,列表不光会用来做显示用,我们同样可以在在上面添加按钮.添加按钮首先要写一个有按钮的xml文件,然后自然会想到用上面的方法定义一个适配器,然后将数据映射到布局文件上 ...

  9. es6函数模块-------初步学习

    初步学习: 函数参数允许尾逗号 function clownsEverywhere( param1, param2, //param2后面有逗号 ) { } 函数参数可以赋初值 利用解构赋值默认值结合 ...

  10. 42. Trapping Rain Water(直方图 存水量 hard)

    Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...