PAT-B 1004. 成绩排名
来源:互联网 发布:如何制作数据曲线图 编辑:程序博客网 时间:2024/05/17 23:22
每输入一行,就去判断是否会更新min或max学生即可;
注意可能会最高最低同为1人,如n=1的情况。
代码:
#include <iostream>#include <string>using namespace std;int main(){int n, score, minn_score=101, maxx_score=-1;string name, id, minn_name, minn_id, maxx_name, maxx_id;cin >> n;while (n --){cin >> name >> id >> score;if (score < minn_score){minn_name = name;minn_id = id;minn_score = score;}if (score > maxx_score){maxx_name = name;maxx_id = id;maxx_score = score;}}cout << maxx_name << " " << maxx_id << endl;cout << minn_name << " " << minn_id << endl;return 0;}
0 0
- PAT-B 1004. 成绩排名
- pat(B) 1004. 成绩排名
- PAT-B 1004. 成绩排名
- PAT-B 1004. 成绩排名
- PAT(B)1004. 成绩排名 (20)
- PAT(B) - 1004. 成绩排名 (20)
- PAT-B 1004. 成绩排名 (20)
- PAT-B 1004. 成绩排名 (20)
- PAT-B] 1004. 成绩排名 [查找]
- 1004. 成绩排名 (20) PAT(B级)
- PAT之成绩排名(B)
- PAT中文版1004.成绩排名
- 1004. 成绩排名 (20){PAT}
- PAT 1004. 成绩排名 (20)
- PAT - 1004. 成绩排名 (20)
- PAT 1004. 成绩排名
- [PAT]1004. 成绩排名 (20)
- PAT 1004. 成绩排名
- 共同好友居民和南方工本费问题和建议您如果
- linux性能问题(CPU,内存,磁盘I/O,网络)
- tyu6jyurgefdert4yujkytrrgfrdw
- rtgbfvdeqwdefwtgehngbfvwedqwefrgtgbefwdw
- VB6.0代码窗口不支持鼠标中键操作滚动条解决方法
- PAT-B 1004. 成绩排名
- PAT-B 1006. 换个格式输出整数
- C语言 mkdir 创建多级目录
- 一切成功源于积累——20140525 10颗子弹和一个子弹
- git
- 打印出任意年份的日历
- PAT-B 1010. 一元多项式求导
- 【NO.1】9x9 Multiplication Table
- Flatten a nested directory in Linux