https://www.patest.cn/contests/pat-a-practise/1036

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,gra,boyc = ,girlc = ,boymin = ,girlmax = -;//n,输入成绩,男生计数,女生计数,男最低分,女最高分
char nam[],gend,id[]; //输入信息
char name_m[],id_m[],name_f[],id_f[];//保存最低分男的个人信息,最高分女的个人信息
scanf("%d",&n);
for(i = ;i < n; i++)
{
scanf("%s %c %s %d",nam,&gend,id,&gra);
if(gend == 'M') {
boyc++;
if(gra < boymin){
boymin = gra;
strcpy(name_m,nam);
strcpy(id_m,id);
} }
else {
girlc++;
if(gra > girlmax){
girlmax = gra;
strcpy(name_f,nam);
strcpy(id_f,id);
}
}
}
if(girlc == ){
printf("Absent\n");
}
else{
printf("%s %s\n",name_f,id_f);
}
if(boyc == ){
printf("Absent\n");
}
else{
printf("%s %s\n",name_m,id_m);
}
if(girlc == ||boyc == ){
printf("NA");
}
else{
printf("%d",girlmax-boymin);
}
return ;
}

PATA 1036. Boys vs Girls (25)的更多相关文章

  1. PAT 甲级 1036 Boys vs Girls (25 分)(简单题)

    1036 Boys vs Girls (25 分)   This time you are asked to tell the difference between the lowest grade ...

  2. PAT 1036 Boys vs Girls (25 分)

    1036 Boys vs Girls (25 分)   This time you are asked to tell the difference between the lowest grade ...

  3. 1036 Boys vs Girls (25分)(水)

    1036 Boys vs Girls (25分)   This time you are asked to tell the difference between the lowest grade o ...

  4. PAT甲级:1036 Boys vs Girls (25分)

    PAT甲级:1036 Boys vs Girls (25分) 题干 This time you are asked to tell the difference between the lowest ...

  5. PAT 1036 Boys vs Girls (25分) 比大小而已

    题目 This time you are asked to tell the difference between the lowest grade of all the male students ...

  6. 1036. Boys vs Girls (25)

    #include <stdio.h>#include <string.h>int main(){ int n,i; while(scanf("%d",&am ...

  7. PAT甲题题解-1036. Boys vs Girls (25)-找最大最小,大水题

    题意:给出n个人的姓名.性别.ID.分数,让你找出其中哪个妹纸分数最高.哪个汉子分数最低.以及他们的差如果没有妹纸或者汉子,则对应输出Absent,差用NA代替. 就是for一遍找最大最小值,水题 # ...

  8. 1036 Boys vs Girls (25)(25 point(s))

    problem This time you are asked to tell the difference between the lowest grade of all the male stud ...

  9. PAT (Advanced Level) 1036. Boys vs Girls (25)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

随机推荐

  1. mysql 加入柱更改列删除列

    MySQL 加入列,改动列,删除列 ALTER TABLE:加入,改动,删除表的列,约束等表的定义. 查看列:desc 表名; 改动表名:alter table t_book rename to bb ...

  2. 我的Spring之旅(二):为请求加入參数

    1.前言 在上一篇我的Spring之旅(一)中,我们仅仅是利用不带參数的请求返回一个网页或一段json,在实际的B/S.C/S网络交互中,请求中须要自己定义的參数.本篇将简单地为之前的请求加入參数. ...

  3. WPF 中动态创建和删除控件

    原文:WPF 中动态创建和删除控件 动态创建控件 1.容器控件.RegisterName("Name",要注册的控件)   //注册控件 2.容器控件.FindName(" ...

  4. 带参跳转其他controller

    public class GoToOtherController : Controller { public ActionResult Index() { var vm = new GetValueF ...

  5. [nginx]invalid number of arguments

    invalid number of arguments nginx出现以下的错误,基本上错误的原因就是少了后面的分号导致. invalid number of arguments

  6. App.xaml介绍

    在App.xaml.cs中指定 public App () { InitializeComponent(); MainPage = new XamarinDemo.MainPage(); } 同时,这 ...

  7. strlen, wcslen, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l, setlocale(LC_CTYPE, "Japanese_Japan")(MSDN的官方示例)

    // crt_strlen.c // Determine the length of a string. For the multi-byte character // example to work ...

  8. WPF ObjectDataProvider的使用-只能检索用

    <Window x:Class="CollectionBinding.MainWindow"        xmlns="http://schemas.micros ...

  9. WPF 绑定到静态属性(4.5)

    1. 声明静态事件 /// <summary> /// 静态属性通知 /// </summary> public static event EventHandler<Pr ...

  10. 重写combobox模板,实现支持过滤的combobox

    先看效果图 客户提出需求后,首选在百度查找可靠方案 看了几个,效果都不理想, 大多是把isEditNable设置成true,IsTextSearchNable设置成false 再对itemsSourc ...