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)初期: 一. ...
随机推荐
- 记录一次gitlab->github企业版的迁移
cd到你想要存放新的工程的文件夹内, 1.使用git clone --mirror命令制作旧git的镜像 $ git clone --mirror git@git.aaaa.com:mario/my- ...
- Spark源码分析 – SchedulerBackend
SchedulerBackend, 两个任务, 申请资源和task执行和管理 对于SparkDeploySchedulerBackend, 基于actor模式, 主要就是启动和管理两个actor De ...
- Buy a home in AU
澳洲留学生买房的几点注意事项: 1. 新房.楼花.或者买地建房,完全不受限制,国民待遇,是政府鼓励的. 2. 留学生签证剩余超12个月,可以购买二手房,但是只能自住不能出租. 3. 银行可以提供50% ...
- Python量化常用函数
# -*- coding: utf-8 -*- # @Author: fangbei # @Date: 2017-08-26 # @Original: price_str = '30.14, 29.5 ...
- Ubuntu 下 mysql 卸载后重安装时遇到的问题
卸载mysql报错解决方法1 dpkg: error processing mysql-server (--configure): dependency problems - leaving unco ...
- Fibonacci----poj3070(矩阵快速幂, 模板)
题目链接:http://poj.org/problem?id=3070 . 就是斐波那契的另一种表示方法是矩阵的幂: 所以是矩阵快速幂:矩阵快速幂学习 #include <cstdio> ...
- Vuex、axios以及跨域请求处理
一.Vuex 1.介绍 vuex是一个专门为Vue.js设计的集中式状态管理架构. 对于状态,我们把它理解为在data中需要共享给其他组件使用的部分数据. Vuex和单纯的全局对象有以下不同: 1. ...
- oracle入门(8)——实战:支持可变长参数、多种条件、多个参数排序、分页的存储过程查询组件
[本文介绍] 学了好几天,由于项目需要,忙活了两天,写出了个小组件,不过现在还只能支持单表操作.也没考虑算法上的优化,查询速度要比hibernate只快了一点点,可能是不涉及多表查询的缘故吧,多表的情 ...
- Python学习笔记(一)数据类型
一.整型和浮点型 Python可以处理任意大小的整数,当然包括负整数,在程序中的表示方法和数学上的写法一模一样 age=10 num=-35 score=98.8 二.布尔类型 布尔值和布尔代数的表示 ...
- Python误区之strip,lstrip,rstrip
最近在处理数据的时候,想把一个字符串开头的“)”符号去掉,所以使用targetStr.lstrip(")"),发现在 将处理完的数据插入到数据库时会出现编码报错,于是在网上搜到了这 ...