当前位置:网站首页>P5714 [deep foundation 3. Case 7] obesity
P5714 [deep foundation 3. Case 7] obesity
2022-07-29 04:54:00 【Chen Yuchen】
BMI The index is a standard commonly used internationally to measure the degree of obesity and thinness of the human body , The algorithm is m/h^2
(40≤m≤120,1.4≤h≤2.0), among mm It refers to weight ( kg ),hh Refers to height ( rice ). The range and judgment results of different body types are as follows :
Less than 18.5: Underweight , Output Underweight;
Greater than or equal to 18.5 And less than 24: Normal weight , Output Normal;
Greater than or equal to 24: obesity , Not only output BMI value ( Use cout The default precision of ), And then line break , And output Overweight;
Now give weight and height data , Need basis BMI The index judges the shape state and outputs the corresponding judgment .
For non C++ Language , At output time , Please round Retain six significant digital outputs , If there is a suffix in the decimal part 00, Do not output suffixes 00.
Please note that , Keeping six significant digits is not keeping six decimal places . for example 114.5149114.5149 The output should be 114.515114.515,9198.109198.10 The output should be 9198.19198.1.
Input format
All in one line .
first line , common 22 A floating point number ,m,nm,n, Weight respectively ( Unit is kgkg), height ( Unit is mm).
Output format
nothing
I/o sample
Input #1 Copy
70 1.72
Output #1 Copy
Normal
explain / Tips
m and h Not more than 3 Decimal place
// How many bits of valid data are reserved
import java.math.*;
import java.util.*;
public class Main{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();
double h = sc.nextDouble();
double sum = m/(Math.pow(h,2));
// Use BigDecimal Medium divide Method for trade-offs
BigDecimal result = new BigDecimal(String.valueOf(sum));
BigDecimal divi = BigDecimal.ONE;
MathContext mc = new MathContext(6);
if(sum<18.5){
System.out.println("Underweight");
}else if(sum>=18.5&&sum<24){
System.out.println("Normal");
}else{
System.out.println(result.divide(divi,mc));
System.out.println("Overweight");
}
}
}
边栏推荐
猜你喜欢

Build auto.js script development environment

Implementation of flutter gesture monitoring and Sketchpad

On prepayment of house purchase

Deep analysis of data storage in memory (Advanced C language)
![[QT learning notes] * insert pictures in the window](/img/72/ecac8fb35a404130ee020db572a4b4.png)
[QT learning notes] * insert pictures in the window

Five correlation analysis, one of the most important skills of data analysts

如何避免示波器电流探头损坏

Using jupyter (I), install jupyter under windows, open the browser, and modify the default opening address

ios面试准备 - 网络篇

怎样监测微型的网站服务
随机推荐
SparkSql批量插入或更新,保存数据到Mysql中
[c language] PTA 7-63 falling ball
[untitled]
Basic grammar of C language
Mysql:The user specified as a definer (‘root‘@‘%‘) does not exist 的解决办法
Word如何查看文档修改痕迹?Word查看文档修改痕迹的方法
Climbing the pit of traffic flow prediction (II): the simplest LSTM predicts traffic flow using tensorflow2
Flutter 手势监听和画板实现
IOS interview preparation - Online
软件测试面试题(四)
On prepayment of house purchase
Five correlation analysis, one of the most important skills of data analysts
Recyclerview switches the focus up and down through the dpad key. When switching to the control outside the interface, the focus will jump left and right
Auto.js脚本开发入门
Simple user-defined authentication interface rules
Delete blank pages in word documents
Box horizontal vertical center layout (summary)
谷歌浏览器 打开网页出现 out of memory
Makefile+Make基础知识
MySQL定时调用预置函数完成数据更新