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. Hibernate4与hibernate3有错误的版本号的主要区别所造成的不一致

    Hibernate版本号修改 Hibernate4的修改较大仅仅有spring3.1以上版本号可以支持,Spring3.1取消了HibernateTemplate,由于Hibernate4的事务管理已 ...

  2. OpenGL(十七) 绘制折线图、柱状图、饼图

    一.绘制折线图 glutBitmapCharacter(GLUT_BITMAP_8_BY_13,label[j])函数可以绘制GLUT位图字符,第一个参数是GLUT中指定的特定字形集,第二个参数是要写 ...

  3. Prism框架在项目中使用

    本文大纲 1.Prism框架下载和说明 2.Prism项目预览及简单介绍. 3.Prism框架如何在项目中使用. Prism框架下载和说明 Prism框架是针对WPF和Silverlight的MVVM ...

  4. delphi自动调整combobox下拉列表宽度(PostMessage CB_SETDROPPEDWIDTH)

    在combobox所在的窗口的Formshow事件里调用即可 procedure SetComboBoxListWidth( AComboBox: TComboBox ); var i: Intege ...

  5. 在WPF中减少逻辑与UI元素的耦合

    原文:在WPF中减少逻辑与UI元素的耦合             在WPF中减少逻辑与UI元素的耦合 周银辉 1,    避免在逻辑中引用界面元素,别把后台数据强加给UI  一个糟糕的案例 比如说主界 ...

  6. cn_sql_server_2012_enterprise_edition_x86_x64_dvd_813295 序列号

    cn_sql_server_2012_enterprise_edition_x86_x64_dvd_813295 序列号 MICROSOFT SQL SERVER 2012 ENTERPRISE CO ...

  7. Vm安装

      说明:都是默认安装,并不需要繁琐设置,所以没有文字说明

  8. 了解Activity

    Android中的activity全都归属于task管理 .task 是多个 activity 的集合,这些 activity 按照启动顺序排队存入一个栈(即“back stack”).android ...

  9. SQL Server 将某一列的值拼接成字符串

    名称 海鲜水产 水果蔬菜 海参 肉禽蛋 牛排 腊味 生鲜食品 将以上一列变成: 生鲜食品,海鲜水产,水果蔬菜,海参,牛排,肉禽蛋,腊味 sql for xml path('')

  10. Linux kernel version dirty

    在我们使用git来管理Linux Kernel的时候,在编译的时候会在你的kernel version加上git commit number 有时候还会出现dirty字样,字面意思是内核被污染的意思. ...