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;
    }
  • 相关阅读:
    Android Studio 的 10 个你非常有可能不知道的技巧
    SSH框架的基本整合
    Spring Boot 配置类1-配置类流程
    Spring Boot web容器启动
    Tomcat介绍
    微服务演进史
    SpringBoot异常报告器
    SpringBoot Profile源码介绍
    SpringBoot Environment使用
    Spring Aware原理
  • 原文地址:https://www.cnblogs.com/cheng07045406/p/3536125.html
Copyright © 2011-2022 走看看