6 solutions
-
0
Guest MOD
-
0
#include <iostream> using namespace std; int main(){ double m,h; cin>>m>>h; double BMI=1.0*m/(h*h); if(BMI<18.5){ cout<<"Underweight"<<endl; }else if(BMI>=18.5&&BMI<24){ cout<<"Normal"<<endl; }else if(BMI>=24){ cout<<BMI<<endl; cout<<"Overweight"<<endl; } return 0; }注意,身高不是整数,BMI也不是整数。 剩下的,正常计算就可以了,再来三个比较,就OK了!!! 如有错请指出。
-
0
代码:
#include<bits/stdc++.h> typedef double ll; using namespace std; const int N=10010; ll h; ll m; int main(){ cin.sync_with_stdio(false); ios::sync_with_stdio(0); cin>>m>>h; ll BMI=m/(h*h); if(BMI<18.5){ cout<<"Underweight"; } else if(BMI>=18.5&&BMI<24){ cout<<"Normal"; } else{ cout<<BMI<<'\n'; cout<<"Overweight"; } return 0; }
- 1
Information
- ID
- 392
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 6
- Tags
- # Submissions
- 354
- Accepted
- 113
- Uploaded By