zoukankan      html  css  js  c++  java
  • zju pat 1036

    //1036
    #include <iostream>
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    using namespace std;
    typedef struct DATA
    {
        char name[20];
        char gender;
        char ID[20];
        int grade;
    };
    DATA data;
    DATA femal_highest;
    DATA male_lowest;
    
    int main()
    {
        int N,i,j,no_count;
        bool easy_flag;
        while(scanf("%d",&N)!=EOF)
        {
            femal_highest.grade = -1;
            male_lowest.grade = 101;
            for(i =0;i<N;i++)
            {
                scanf("%s %c %s %d",data.name,&data.gender,data.ID,&data.grade);
                if(data.gender == 'F')
                {
                    if(data.grade > femal_highest.grade)
                    {
                        strcpy(femal_highest.name,data.name);
                        strcpy(femal_highest.ID,data.ID);
                        femal_highest.grade = data.grade;
                    }
                }
                else
                {
                    if(data.grade < male_lowest.grade)
                    {
                        strcpy(male_lowest.name,data.name);
                        strcpy(male_lowest.ID,data.ID);
                        male_lowest.grade = data.grade;
                    }
                }
            }
            if(femal_highest.grade !=-1)
            {
                printf("%s %s
    ",femal_highest.name,femal_highest.ID);
            }
            else
            {
                printf("Absent
    ");
            }
            if(male_lowest.grade != 101)
            {
                printf("%s %s
    ",male_lowest.name,male_lowest.ID);
            }
            else
            {
                printf("Absent
    ");
            }
            if(femal_highest.grade!=-1 && male_lowest.grade !=101)
                printf("%d
    ",femal_highest.grade - male_lowest.grade);
            else
                printf("NA
    ");
        }
        return 0;
    }
  • 相关阅读:
    每日日报7月15日
    每日日报7月14日
    ecplise下 java问题处理
    Visual Studio Code for .Net Framework
    Go语言操作MySQL数据库
    Go语言Gin-4中间件
    Go语言Gin-2.数据传输
    Go语言Gin-1.路由
    13.Go语言-并发编程
    12.Go语言-网络编程
  • 原文地址:https://www.cnblogs.com/cheng07045406/p/3536125.html
Copyright © 2011-2022 走看看