码迷,mamicode.com
首页 > 其他好文 > 详细

百练 2680:化验诊断

时间:2015-02-21 00:14:47      阅读:360      评论:0      收藏:0      [点我收藏+]

标签:

总时间限制: 
1000ms
 
内存限制: 
65536kB
描述
下表是进行血常规检验的正常值参考范围,及化验值异常的临床意义:
技术分享

给定一张化验单,判断其所有指标是否正常,如果不正常,统计有几项不正常。化验单上的值必须严格落在正常参考值范围内,才算是正常。正常参考值范围包括边界,即落在边界上也算正常。
输入
技术分享
输出
对于每组测试数据,输出一行。如果所有检验项目正常,则输出:normal;否则输出不正常的项的数目。
样例输入
2
female 4.5 4.0 115 37 200
male 3.9 3.5 155 36 301
样例输出
normal
3
 1 #include<iostream>
 2 using namespace std;
 3 
 4 struct ill {
 5     string sex;
 6     double WBC;
 7     double RBC;
 8     int HGB;
 9     int HCT;
10     int PLT;
11 };
12 ill test[100+5];
13 
14 int main() {
15     int k;
16     cin >> k;
17     for(int i=0; i<k; i++) {
18         cin >> test[i].sex >> test[i].WBC >> test[i].RBC >> test[i].HGB
19             >> test[i].HCT >>test[i].PLT;
20         int tot=0;
21         if(test[i].WBC > 10 || test[i].WBC < 4) tot++;
22         if(test[i].RBC > 5.5 || test[i].RBC < 3.5) tot++;
23         if(test[i].HGB > 160 || test[i].HGB < 110 
24                 || (test[i].HGB < 120 && test[i].sex == "male") 
25                 || (test[i].HGB > 150 && test[i].sex == "female")) tot++;
26         if(test[i].HCT > 48 || test[i].HCT < 36 
27                 || (test[i].HCT < 42 && test[i].sex == "male")
28                 || (test[i].HCT > 40 && test[i].sex == "female")) tot++;
29         if(test[i].PLT > 300 || test[i].PLT < 100) tot++;
30         if(tot) cout << tot << "\n";
31         else cout << "normal\n";
32     }
33     return 0;
34 }

 

百练 2680:化验诊断

标签:

原文地址:http://www.cnblogs.com/liangyongrui/p/4296764.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!