描述java
下表是进行血常规检验的正常值参考范围,及化验值异常的临床意义:
给定一张化验单,判断其全部指标是否正常,若是不正常,统计有几项不正常。化验单上的值必须严格落在正常参考值范围内,才算是正常。正常参考值范围包括边界,即落在边界上也算正常。测试
输入spa
输出code
对于每组测试数据,输出一行。若是全部检验项目正常,则输出:normal;不然输出不正常的项的数目。orm
样例输入blog
2 female 4.5 4.0 115 37 200 male 3.9 3.5 155 36 301
样例输出ci
normal 3
来源class
计算概论05-模拟考试1 http://bailian.openjudge.cn/practice/2680/import
import java.util.Scanner; public class OpenJudge2680 { public static void main(String[] args) { Scanner cin = new Scanner(System.in); final int n = cin.nextInt(); for (int i = 0; i < n; i++) { String gender = cin.next(); double wbc = cin.nextDouble(); double rbc = cin.nextDouble(); int hgb = cin.nextInt(); int hct = cin.nextInt(); int plt = cin.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); } } cin.close(); } }