博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
A1036. Boys vs Girls (25)
阅读量:5861 次
发布时间:2019-06-19

本文共 1523 字,大约阅读时间需要 5 分钟。

This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.

Input Specification:

Each input file contains one test case. Each case contains a positive integer N, followed by N lines of student information. Each line contains a student's name, gender, ID and grade, separated by a space, where name and ID are strings of no more than 10 characters with no space, gender is either F (female) or M (male), and grade is an integer between 0 and 100. It is guaranteed that all the grades are distinct.

Output Specification:

For each test case, output in 3 lines. The first line gives the name and ID of the female student with the highest grade, and the second line gives that of the male student with the lowest grade. The third line gives the difference gradeF-gradeM. If one such kind of student is missing, output "Absent" in the corresponding line, and output "NA" in the third line instead.

Sample Input 1:

3Joe M Math990112 89Mike M CS991301 100Mary F EE990830 95
Sample Output 1:
Mary EE990830Joe Math9901126
Sample Input 2:
1Jean M AA980920 60
Sample Output 2:
AbsentJean AA980920NA

#include
struct{ char name[11]; char gender; char id[11]; int grade;}temp,fh,mlo;int main(){ int n; scanf("%d",&n); //getchar(); fh.grade=0; mlo.grade=100; int countf=0,countm=0; for(int i=0;i
fh.grade) fh=temp; }else if(temp.gender=='M'){ countm++; if(temp.grade

转载于:https://www.cnblogs.com/cobread/p/10846246.html

你可能感兴趣的文章
这两年在大数据行业中的工作总结
查看>>
angular学习
查看>>
React16.x 特性剪辑(上)
查看>>
强制缓存和协商缓存有什么区别
查看>>
企业专属云计算平台落地,助力企业实现数字化转型
查看>>
多线程通信的三大法器,你真的会用吗?
查看>>
Python爬虫--- 1.4 正则表达式:re库
查看>>
Xcode 10 升级导致项目报错的常见问题
查看>>
我们来说一说TCP神奇的40ms
查看>>
[LeetCode] 97. Interleaving String
查看>>
微服务架构组件分析
查看>>
Mongodb数据的导出与导入
查看>>
在SAP UI中使用纯JavaScript显示产品主数据的3D模型视图
查看>>
前端编码规范之:样式(scss)编码规范
查看>>
python 设计模式-适配器模式
查看>>
【Leetcode】82. 删除排序链表中的重复元素 II
查看>>
vue_music:排行榜rank中top-list.vue中样式的实现:class
查看>>
修改校准申请遇到的问题
查看>>
第一天·浏览器内核及Web标准
查看>>
Java版本兼容问题
查看>>