Laboratory diagnosis

006: Laboratory diagnosis
View and submit statistical questions
Total time limit: 1000ms Memory limit: 65536kB
Description The
following table is the normal value reference range for routine blood tests and the clinical significance of abnormal laboratory values:
Insert picture description here

Given a laboratory test sheet, judge whether all its indicators are normal. If not, there are several abnormalities in the statistics. The value on the test sheet must strictly fall within the normal reference value range to be considered normal. The normal reference value range includes the boundary, and it is considered normal even if it falls on the boundary.
Input

output
for each test case, the output line. If all inspection items are normal, output: normal; otherwise, output the number of abnormal items.
Sample input
2
female 4.5 4.0 115 37 200
male 3.9 3.5 155 36 301
Sample output
normal
3
Source
Introduction to Calculation 05-Mock 1

#include<iostream>
#include<cstring>
#include<string>
using namespace std;
#define N 5//相当于定义 N的容量是5
string sex;
double a[5];
double minn[2][5]={
    
    {
    
    4.0,3.5,120,42,100},{
    
    4.0,3.5,110,36,100}} ;
double maxx[2][5]={
    
    {
    
    10.0,5.5,160,48,300},{
    
    10.0,5.5,150,40,300}};
int main()
{
    
    
    int i,t,k,cnt;
    cin >> t;
    while(t--)
    {
    
    
        cin>>sex;
        for(int i=0;i<5;i++)
        cin >> a[i];
        k=(sex=="female"?1:0);
        cnt=0;
        for(int i=0;i<5;i++)
        {
    
    
            if(a[i]<minn[k][i]||a[i]>maxx[k][i])
            cnt++;
        }
        if(cnt==0)
        cout << "normal" << endl;
        else
        cout << cnt << endl;
    }
    return 0;
}

Pay attention to the use of max and min in the definition.
There are also small details. Look at the input number when debugging.
Pay attention to the array overflow

Guess you like

Origin blog.csdn.net/qq_51082388/article/details/113063932