【题目来源】
洛谷:AT_abc397_a [ABC397A] Thermometer - 洛谷 (luogu.com.cn)
【题目描述】
Takahashi measured his body temperature and found it to beX ∘ C X^{\circ}CX∘C.
高桥测量了他的体温,发现是 X 摄氏度。
Body temperature is classified into the following:
体温分类如下:
- Higher than or equal to38 ∘ C : 38^{\circ}C:38∘C:“High fever”
高于或等于 38 摄氏度:高烧(High fever) - Higher than or equal to37.5 ∘ C 37.5^{\circ}C37.5∘Cand lower than38 ∘ C : 38^{\circ}C:38∘C:“Fever”
高于或等于 37.5 摄氏度且低于 38 摄氏度:发烧(Fever) - Lower than37.5 ∘ C : 37.5^{\circ}C:37.5∘C:“Normal”
低于 37.5 摄氏度:正常(Normal)
Which classification does Takahashi’s body temperature fall into? Present the answer as an integer according to the Output section.
高桥的体温属于哪一类?根据输出部分的要求,以整数形式给出答案。
【输入】
The input is given from Standard Input in the following format:
X【输出】
Print an integer specified below corresponding to Takahashi’s body temperature classification.
- High fever: 11
- Fever: 22
- Normal: 33
【输入样例】
40.0【输出样例】
1【算法标签】
#入门# #模拟#
【代码详解】
#include<bits/stdc++.h>usingnamespacestd;doublex;// 定义变量 x,用于存储输入的温度值intmain(){cin>>x;// 输入温度值if(x>=38.0){// 如果温度大于等于 38.0cout<<1<<endl;// 输出 1}elseif(x>=37.5){// 如果温度大于等于 37.5 但小于 38.0cout<<2<<endl;// 输出 2}else{// 如果温度小于 37.5cout<<3<<endl;// 输出 3}return0;// 程序结束}【运行结果】
40.0 1