描述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(); } }