Poj3299 Humidex java 分析

《统计学习方法》——李航 学习大纲 最近在学习李航写的统计学习方法概论, 每一章都用xmind理清了思路,括号里是书里的公式,第一次写博文,敬请指教~~~~ 第一章 统计学习方法论 第二章 感知机 每个方法其实只需要着重掌握三要素和输入输出就可以了,主要看模型、策略和算法。 感知机主要是二类分类的线性分类模型。 看到后面会注意感知机和支持向量机的区别。 第三章 k近 阅读详情

这题主要是考研 枚举 的思路, 读清题目, 找到关键要枚举的内容十分重要, 在第一次写的时候忽略了有“H”的可能,好在代码量不大,后期修改很方便。 题目中提到的数据的范围[-100, 100], 所以就可以用设置超值过滤的方式去筛选。 结合枚举的可能实例,公式要发生变化,可以写一行,可以分开写, 题目对内存占用还是放的很宽的,所以可以想定义几个变量就定义几个。 这里可以不用考虑先除减再加乘,和除0的可能。值得注意的是,题目中给定的e, 是自然数,对于需要用到的求导可以用Math.log()直接求出, 从而省略了用 log(result) / log(base).  OJ 支持java 1.5 所以switch 不能识别String.


Humidex
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 19726 Accepted: 7139

Description

Adapted from Wikipedia, the free encyclopedia

The humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and humidity. It differs from the heat index used in the United States in using dew point rather than relative humidity.

When the temperature is 30°C (86°F) and the dew point is 15°C (59°F), the humidex is 34 (note that humidex is a dimensionless number, but that the number indicates an approximate temperature in C). If the temperature remains 30°C and the dew point rises to 25°C (77°F), the humidex rises to 42.3.

The humidex tends to be higher than the U.S. heat index at equal temperature and relative humidity.

The current formula for determining the humidex was developed by J.M. Masterton and F.A. Richardson of Canada's Atmospheric Environment Service in 1979.

According to the Meteorological Service of Canada, a humidex of at least 40 causes "great discomfort" and above 45 is "dangerous." When the humidex hits 54, heat stroke is imminent.

The record humidex in Canada occurred on June 20, 1953, when Windsor, Ontario hit 52.1. (The residents of Windsor would not have known this at the time, since the humidex had yet to be invented.) More recently, the humidex reached 50 on July 14, 1995 in both Windsor and Toronto.

The humidex formula is as follows:

humidex = temperature + h
h = (0.5555)× (e - 10.0)
e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(dewpoint+273.16)))]
where exp(x) is 2.718281828 raised to the exponent x.

While humidex is just a number, radio announcers often announce it as if it were the temperature, e.g. "It's 47 degrees out there ... [pause] .. with the humidex,". Sometimes weather reports give the temperature and dewpoint, or the temperature and humidex, but rarely do they report all three measurements. Write a program that, given any two of the measurements, will calculate the third.

You may assume that for all inputs, the temperature, dewpoint, and humidex are all between -100°C and 100°C.

Input

Input will consist of a number of lines. Each line except the last will consist of four items separated by spaces: a letter, a number, a second letter, and a second number. Each letter specifies the meaning of the number that follows it, and will be either T, indicating temperature, D, indicating dewpoint, or H, indicating humidex. The last line of input will consist of the single letter E.

Output

For each line of input except the last, produce one line of output. Each line of output should have the form:

T number D number H number
where the three numbers are replaced with the temperature, dewpoint, and humidex. Each value should be expressed rounded to the nearest tenth of a degree, with exactly one digit after the decimal point. All temperatures are in degrees celsius.

Sample Input

T 30 D 15
T 30.0 D 25.0
E

Sample Output

T 30.0 D 15.0 H 34.0
T 30.0 D 25.0 H 42.3

import java.util.Scanner;

public class Poj3299
{
    public static void main(String[] args)
    {
	Scanner scan = new Scanner(System.in);
	double t = 0.0, d = 0.0, h = 0.0;
	final double exp = 2.718281828;
	final double max = 101;
	int counter = 0;
	while(!scan.hasNext("E"))
	{
	    counter = 0;
	    t = max;
	    d = max;
	    h = max;
	    while(true)
	    {
		if(counter == 2) break;
		switch(scan.next().toCharArray()[0])
		{
		case 'T':
		    t = scan.nextDouble();
		    break;
		case 'D':
		    d = scan.nextDouble();
		    break;
		case 'H':
		    h = scan.nextDouble();
		    break;
		}
		counter++;
	    }
	    if(h == 101)
		h = 0.5555 * (6.11 * Math.pow(exp, (5417.7530 * ((1.0 / 273.16) - (1.0 / (d + 273.16))))) - 10.0) + t;
	    else if(t == 101)
		t = h - 0.5555 * (6.11 * Math.pow(exp, (5417.7530 * ((1.0 / 273.16) - (1.0 / (d + 273.16))))) - 10.0);
	    else d = 1.0 / (1.0 / 273.16 - (Math.log(((h - t) / 0.5555 + 10.0) / 6.11) / 5417.7530)) - 273.16;
	    System.out.printf("T %.1f D %.1f H %.1f \n", t, d, h);
	}
    }
}



车载以太网:PHY(物理层)介绍 本文以TJA1101芯片为实例介绍了车载以太网PHY(物理层)组成。 阅读详情

相关推荐

电机驱动技术中关于磁阻转矩生成的理解

正交在物理学和数学中指的是两个方向或两个向量之间的夹角为90°(直角)。在图中,当气隙磁场的轴线与转子轴线的夹角为90°时,我们称它们为正交。转子磁极的方向。通常由转子的磁极中心指向另一极的连线表示。转子轴线用图示中的d 轴表示。通过对定子、转子、气隙磁场、磁力线的理解,我们可以清晰地分析不同角度下电磁转矩的方向。这种分析不仅有助于电机的理论学习,还能为实际设计提供重要参考。掌握这些基础知识后,可以更好地理解电机工作原理及优化其性能。

weixin_48327795的博客 2081

POJ 3299 Humidex Java题解

本文主要是针对POJ-3299-Humidex使用Java实现的相关过程,以及初学者的注意事项。

Exticntion的博客 750

LVGL 离线字体转换lv_font_conv本地安装

LVGL FONT CONV 离线版本

liu132641的专栏 3407

poj 3299 java

今天尝试一下poj平台 略有点忐忑 不知道自己能不能搞定。 上网查了一下poj题目推荐,所以从poj 3299题开始练手。 后来发现试了好几次都不成功,弄得我好郁闷,所以往1000这个sample里看看是什么出错,发现公共类public class 后面不应该写 “Humidex”而是要写"Main"。 初心者的才会犯的尴尬事情。 其次是自己编写的会造成Presentation Erro...

weixin_33995481的博客 176

ESP32 STA AP模式下,设备连接 ESP的AP 后无法上网,无法访问域名上网(或者Failed to enable NAPT)

ESP32 STA AP模式下,设备连接 ESP的AP 后无法上网,无法访问域名上网(或者Failed to enable NAPT)1.可能是ESP STA模式未成功连接到路由器,确保 STA 成功连接到外部网络。2.检查 STA 和 AP 的网络配置是否正确,避免子网冲突。3.ESP32的NAPT功能未正确启用,确保 menuconfig 中已启用 IP_NAPT。4.DNS服务器未正确配置。

qq_34885669的博客 1547

基于Python的新闻聚合与推荐系统:抓取多新闻网站内容并根据用户兴趣进行个性化推荐

本文介绍了如何使用Python构建一个新闻聚合与推荐系统,涵盖了从新闻数据抓取、用户兴趣建模到推荐算法实现的全过程。通过爬虫技术抓取新闻网站内容,使用TF-IDF、Word2Vec等算法进行内容分析,并通过推荐算法向用户推送个性化的新闻,最终帮助用户快速获取自己感兴趣的信息。你可以根据具体需求,进一步扩展和优化系统。例如,加入更多的推荐算法、优化爬虫的抓取效率、增强前端展示的互动性等。通过本文的指导,您应该能够构建一个完整的新闻聚合与推荐系统,并为用户提供个性化的新闻推荐服务。

2201_76125261的博客 1520

POJ 3299 java

import java.util.Scanner; public class Main { static double exp=2.718281828; public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(true) { //初始化三个变量 double temp=0; double dewpoint=0; double humidex=0; in

qq_45789762的博客 215

10、智慧变电站 - 加载vue大屏元素(整体效果)

这一篇文章非常简单,但是也非常出效果阅读前面几篇文章,都可以看到有顶部、左侧、右侧的面板,主要我不会录gif图片,大屏元素面板还有一些动态加载的效果。 vue的transition标签 Vue 提供了 transition 的封装组件,可以给任何元素和组件添加进入/离开过渡;在进入/离开的过渡中,会有 6 个 class 切换:v-enter 、v-enter-active 、v-enter-to 、v-leave 、v-leave-active 、v-leave-to。我们正好使用这个特性来达到面板进入

github_39988036的博客 1043

POJ_3299 Humidex(简单题)

题意: 很长,但是重点就是几个公式。 思路: 题目给出了公式,知道两个未知量求第三个。 C要注意输入时适当的getchar()。 另外在输出的时候用G++的编译器总是过不了double类型变量lf占位符输出。解决方法是要么改成f占位,要么改成C++编译器输出。 代码实现: #include #include #include #include #include using

EaShion1994的专栏 1269

MOSFET关断尖峰电压的机理与抑制

MOSFET在电力电子系统中存在开关尖峰电压/电流问题,主要源于寄生电感、密勒电容及开关瞬态特性。尖峰会引发过压击穿、功率损耗和EMI干扰。抑制措施包括优化驱动电路、添加缓冲网络(RC/RCD)、降低寄生电感(改进PCB布线/封装)、使用快速二极管及远端负载特殊处理(电抗器/滤波器)。系统性的器件选型与电路设计是确保功率电子稳定运行的关键。

硬核科技 1837

cartographer如何使用2个反光柱子作为一个landmark

2个反光柱的摆放要求:靠着墙摆,因为我们只能从一侧看到2个反光柱,从两侧都看到至少需要3个反光柱来定位。 landmark检测原理:因为我们是从一侧看到2个反光柱,所以看到2个反光柱在一帧激光数据中会有顺序,有2种情形,如下图 这两种情形,我们发现 情形1: 这种情形2个反光柱子被检测到的激光角度小于180,我们认为大一些激光角度的是原点。 情形2: 这种情形2个反光柱子被检测到的激光角度大于180,我们认为小一些激光角度的是原点。 这样原点就固定下来,并是唯一的。2个反光柱构成的坐标系也就确定了。和激光坐

南北粉面馆 3829

poj3299

[code="java"]package easy; import java.util.Scanner; /** *poj3299 easy * printf("%f",double);??? * @author NC */ public class Poj3299 { public static void main(String[] args) {...

nc200830740306的专栏 163

《QT+PCL》点云的点选与框选

【代码】《QT+PCL》点云的点选与框选。

阁楼 3607

POJ3299Humidex(JAVA

Description Adapted from Wikipedia, the free encyclopedia The humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and humidity. It differs from the heat index used in the United States in using dew point rather

Gluskin的博客 464

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

POJ 刷题系列:3299. Humidex

POJ 刷题系列:3299. Humidex传送门:POJ 3299. Humidex题意: 给定T, D, H中的任意两个数,求另外一个。 思路: 公式由题目给定,如下: humidex = temperature + h h = (0.5555)× (e - 10.0) e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(dewpoi

Demon-初来驾到 1626

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

poj 3299 Humidex

题目链接:http://poj.org/problem?id=3299 挺扯蛋的一题,本来想刷点水题,结果让这题的题目给虐了...抽空得好好补补英语了。主要是公式的推导 代码: #include<iostream>#include<cstdio>#include<math.h>usingnamespacestd;f...

weixin_34321977的博客 138

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

POJ - 3299 Humidex

题意:已知两数,根据公式求第三个数。 分析: 1、.lfG++编译不过的C++可能编译过。 2、输出.lf改成.f后G++可编译过。 #pragma comment(linker, "/STACK:102400000, 102400000") #include<cstdio> #include<cstring> #include<cstdl...

Cherrychan2014的博客 194

poj日记(3299)

这几天刚上手刷poj的题,先尝试一些简单题,今天3299 Description Adapted from Wikipedia, the free encyclopedia The humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and

luantai6098的博客 464

Humidex--POJ 3299

1、题目类型:数论。 2、解题思路:水题。 3、注意事项:esp表示e的指数函数。 4、实现方法: #include<iostream>#include<math.h>#include<algorithm>using namespace std;int main(){ char ch1,ch2; double temp,dew,hum,h...

weixin_34349320的博客 143

html元素设置margin,HTML元素margin、padding的默认值

CXF 自定义拦截器此例子来自apache cxf sample. /** * Licensed to the Apache Software Foundation (ASF) under one * or more ...osgEarth编译的一些问题这两天借着osg培训的机会捯饬了下64位osgearth的编译.遇到了一些问题: 首先我没有编译osg,用的提供的osg3.2.1编译好的6...

weixin_32142311的博客 203

python敲七游戏代码_python每个文件都需要顶部注释,那今天介绍一个方法,只需要设置一次,下次新建python文件后,注释自动出现在顶部的方法...

python每个文件都需要顶部注释,那今天介绍一个方法,只需要设置一次,下次新建python文件后,注释自动出现在顶部的方法只需要在file -----settings------file and code templats----python file,空白服复制以下代码粘贴进去即可 ,下次新建文件时 会自动带出来#!/usr/bin/env python# -*- coding: utf-8 ...

weixin_39628945的博客 392

获取图片的主色调-java

import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.ut

BtQnIT的专栏 6581

POJ3299-Humidex

全解题报告索引目录 -> 【北大ACM – POJ试题分类】 转载请注明出处:http://exp-blog.com ------------------------------------------------------------------------- 提示:纯粹的数学公式,连推导公式都可以省了= = //Memory Time //240K ...

ζёСяêτ - 小優YoU 8004

Java EE 进阶:11. SpringBoot 统一功能处理(第二弹):DispatcherServlet 源码分析+适配器模式

Java EE 进阶:11. SpringBoot 统一功能处理(第二弹):DispatcherServlet 源码分析+适配器模式

要努力去发光,而不是被照亮~ 331

beaTunes 6.0.3 完整中文化实践:界面 + 帮助本地化、一个可回退的离线包,外加一次不靠调内存的卡顿优化

本文基于beaTunes 6.0.3,通过修改资源包与覆盖帮助目录,实现界面1646/1674键、帮助27页全中文(界面约98%、帮助100%),仅剩搜索索引因技术限制未汉化。不修改class文件,避免风险。通过PowerShell脚本安全注入语言包、覆盖HTML内容,并保留完整备份与回退机制。实测表明,软件卡顿非内存不足,无需调整-Xmx,关键在于正确配置JVM参数。强调操作需在正版授权下进行,禁止分发修改版,确保安全可控。

wdhuag的博客 250

Spring Boot + LangChain4j 实战多模态:上传截图、流式输出、单 Jar 部署全流程

本文介绍一个纯Java实现的截图转文字Demo,基于JDK21 + Spring Boot 3.5.16 + LangChain4j 1.20.2 + Vue3,支持灵活传参、流式输出与Markdown自动折叠。无需Python或GPU,仅通过云端多模态接口即可完成图像理解与文本生成。重点解决接口变更、流式调用、图片压缩、并发限流等实战坑点,强调Java在多模态场景下的可行性与工程优势。源码已开源,一键运行即可体验。

sch7979的博客 660
下一篇: Poj 1451 JAVA 个人解题报告
Danielwzl
博客等级 码龄12年 0粉丝 3原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值