PAT a1036题解
来源:互联网 发布:危险品资格证考试软件 编辑:程序博客网 时间:2024/05/21 09:29
#include <cstdio>struct Stu{char name[15];char id[15];char sex;int score;}tmp, min, max;int main(){min.score = 101;max.score = -1;int n;scanf("%d", &n);for(int i = 0; i < n; i++){scanf("%s %c %s %d", tmp.name, &tmp.sex, tmp.id, &tmp.score);if(tmp.sex == 'M'){if(tmp.score < min.score){min = tmp;}}if(tmp.sex == 'F'){if(tmp.score > max.score){max = tmp;}}}if(min.score != 101 && max.score != -1){printf("%s %s\n", max.name, max.id);printf("%s %s\n", min.name, min.id);printf("%d", max.score - min.score);}else if(max.score == -1 && min.score != 101){printf("Absent\n");printf("%s %s\n", min.name, min.id);printf("NA");}else if(max.score != -1 && min.score == 101){printf("%s %s\n", max.name, max.id);printf("Absent\n");printf("NA");}else if(max.score == -1 && min.score == 101){printf("Absent\n");printf("Absent\n");printf("NA");}return 0;}
阅读全文
1 0
- PAT a1036题解
- [PAT] A1036
- PAT A1036
- PAT-A1036
- A1036
- 【PAT】A1036. Boys vs Girls (25)
- PAT A1036. Boys vs Girls (25)
- PAT-A1036 Boys vs Girls(25) (模拟)
- PAT 1001-1010 题解
- PAT 1011-1020 题解
- PAT 1021-1030 题解
- PAT 1031-1040 题解
- PAT 1041-1050 题解
- PAT 1051-1060 题解
- PAT(basic level)题解
- PAT乙级题解
- PAT题解目录
- PAT甲级题解目录
- Encoding(字符串处理)
- hdu 3970(欧拉+逆元)
- 剑指Offer面试题10[二进制中1的个数]
- HDU 4053 or ZOJ 3541 The Last Puzzle【区间dp】【经典题】
- ConcurrentLinkedQueue原理
- PAT a1036题解
- LeetCode: 204. Count Primes判断是否为素数的高效方法
- BZOJ 1337 计算几何 解题报告
- Github pull request流程
- java 枚举类
- 当前不会命中断点,源代码与原始版本不同
- java调用C# webservice接口使用axis报错
- elastic search plugin head install guids
- PAT a1037题解