总时间限制: 1000ms 内存限制: 65536kB
描述
下表是进行血常规检验的正常值参考范围,及化验值异常的临床意义:
给定一张化验单,判断其所有指标是否正常,如果不正常,统计有几项不正常。化验单上的值必须严格落在正常参考值范围内,才算是正常。正常参考值范围包括边界,即落在边界上也算正常。
输入
输出
对于每组测试数据,输出一行。如果所有检验项目正常,则输出:normal;否则输出不正常的项的数目。
样例输入
2
female 4.5 4.0 115 37 200
male 3.9 3.5 155 36 301
样例输出
normal
3
Accepted代码
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
for (int i=0;i<n;i++) {
String gender=in.next();
double wbc=in.nextDouble();
double rbc=in.nextDouble();
int hgb=in.nextInt();
int hct=in.nextInt();
int plt=in.nextInt();
int count=0;
if (wbc<4.0 || wbc>10.0) count++;
if (rbc<3.5 || rbc>5.5) count++;
if ("male".equals(gender)) {
if (hgb<120 || hgb>160) count++;
if (hct<42 || hct>48) count++;
}
else if ("female".equals(gender)) {
if (hgb<110 || hgb>150) count++;
if (hct<36 || hct>40) count++;
}
if (plt<100 || plt>300) count++;
if (count==0)
System.out.println("normal");
else
System.out.println(count);
}
in.close();
}
}