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的更多相关文章

  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. Spring AOP和事务的相关陷阱

    1.前言 2.嵌套方法拦截失效 2.1 问题场景 2.2 解决方案 2.3 原因分析 2.3.1 原理 2.3.2 源代码分析 3.Spring事务在多线程环境下失效 3.1 问题场景 3.2 解决方 ...

  2. 在HTML里面HEAD部分的META元素要表达的内容是什么

    1.name属性主要有以下几种参数: A.Keywords(关键字) 说明:keywords用来告诉搜索引擎你网页的关键字是什么. 举例:<meta name ="keywords&q ...

  3. 原!linux 监控 jar定时任务 挂了重启 脚本

    #!/bin/bash time=$(date "+%Y-%m-%d %H:%M:%S") echo "monitor start at: ${time}" P ...

  4. python [:-1] 与 [::-1]

    line = "abcde"line[:-1]结果为:'abcd' line = "abcde"line[::-1]结果为:'edcba' [:-1] b = ...

  5. 【我的Android进阶之旅】Jenkins挂载slave节点,增强分布式编译的效率

    由于公司的Jenkins任务越来越多,而且所有的Android Jenkins任务都在同一台服务器上进行编译,而且该服务器配置Jenkins任务最多3个任务同时运行,所以有时候大家一起编译的时候,只能 ...

  6. EditText把回车键变成搜索

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/mingyue_1128/article/details/31376159 在xml文件里的EditT ...

  7. python学习笔记(二十五)重写父类方法

    python继承中,如果子类在调用某个方法时,它首先是从派生类(也就是当前类)中去找对应的方法,如果当前类中找不到对应的方法,就会去基类(派生类)中去逐个查找. 若父类的方法不能满足子类的需要,那么子 ...

  8. C语言可以分配的最大内存

    前言 最近用C刷PAT算法题目, 发现C语言有太多需要关注大小范围的东西必须 知道, 虽说挺麻烦, 但也挺有意思. int最大值是多少 首先就是int类型的取值范围, 这个太常用. C语言标准规定最低 ...

  9. kettle配置命名参数

    bat 调度文件如下 cd D:/Program Files/kettle700/data-integrationKitchen.bat /rep repository /dir /TEST /job ...

  10. day5-正则表达式 re

    re模块用于对python的正则表达式的操作. 字符: . 匹配除换行符以外的任意字符 \w 匹配字母或数字或下划线或汉字 \s 匹配任意的空白符 \d 匹配数字 \b 匹配单词的开始或结束 ^ 匹配 ...