计蒜课 蓝桥模拟五 成绩管理系统
来源:互联网 发布:网络主播可以做广告吗 编辑:程序博客网 时间:2024/05/16 06:44
利用map的键值对,每次存时比较成绩大小,若新成绩更高则更新,若无则直接插入pair对。
利用stu.insert(pair
#include<cstdio>#include<iostream>#include<cmath>#include<map>#include<string>#include<cstring>#include<iterator>#define INF 0x3f3f3f3fusing namespace std;typedef pair<string,int>P;int main(){ map<string,int>::iterator it; map<string,int>stu; char s[10]; while(~scanf("%s",s)) { if(s[0]=='i') { string na; int sc; cin>>na>>sc; if(stu.find(na)!=stu.end()) { it=stu.find(na); if(it->second<sc) { stu[na]=sc; } } else stu.insert(P(na,sc)); } else if(s[0]=='f') { string n; cin>>n; cout<<stu[n]<<endl; } } return 0; }
0 0
- 计蒜课 蓝桥模拟五 成绩管理系统
- 蓝桥 分糖果 (模拟)
- 滑动解锁 蓝桥模拟赛
- 2017蓝桥模拟赛 猜算式
- 蓝桥模拟题 排列序数(康托展开)
- 2017 蓝桥模拟 排列序数 康托展开
- 蓝桥模拟题 还款计算(二分搜索)
- 1054 : 滑动解锁 hihocoder & 蓝桥2017模拟
- 用c++模拟实现一个学生成绩管理系统
- 成绩管理系统
- 成绩管理系统
- 成绩管理系统
- 成绩管理系统
- 成绩管理系统
- 成绩管理系统
- 蓝桥
- 2017蓝桥模拟赛 滑动解锁 (深搜 条件判断)
- 【Windows Form 实战】学生成绩管理系统(五) 学生模块设计
- uva160 Factors and Factorials
- Ubuntu与Windows时差问题
- C语言中枚举的使用
- ACM递归递推练习 Problem C
- Oracle PL/SQL编程之八: 把触发器说透
- 计蒜课 蓝桥模拟五 成绩管理系统
- 第一篇
- js观察者模式
- 队列学习
- poj 3070 Fibonacci(矩阵快速幂)
- Oracle PL/SQL编程之六: 把过程与函数说透
- hibernate 初级
- [LintCode]Minimum Adjustment Cost
- spring整合mybatis记录