Sicily 1818. 成绩转换
来源:互联网 发布:淘宝买中药靠谱么 编辑:程序博客网 时间:2024/05/16 04:32
用了STL的map.
只需要正常输入, 可以达到覆盖效果.
时间有点慢, 用了1.56sec
// Problem#: 1818// Author#: Reid Chan#include <iostream>#include <map>#include <string>using namespace std;void level(int s) { if (90 <= s && s <= 100) { cout << 'A' << endl; } else if (80 <= s && s <= 89) { cout << 'B' << endl; } else if (70 <= s && s <= 79) { cout << 'C' << endl; } else if (60 <= s && s <= 69) { cout << 'D' << endl; } else if (0 <= s && s <= 59){ cout << 'E' << endl; } else { cout << "Score is error!" << endl; }}int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; map<string, int> ppl; string name; int score; for (int i = 0; i < n; ++i) { cin >> name >> score; ppl[name] = score; } map<string, int>::iterator it; for (int i = 0; i < m; ++i) { cin >> name; it = ppl.find(name); if (it != ppl.end()) { level(it->second); } } } return 0;}
0 0
- Sicily 1818. 成绩转换
- sicily--1818. 成绩转换
- sicily 1818.成绩转换
- Sicily 1818. 成绩转换
- Sicily 1818. 成绩转换
- Sicily 1818. 成绩转换
- sicily 1818 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- 成绩转换
- UVa 11526 - H(n)
- 项目Extjs前台开发模版
- 20130813_Node.JS + MongoDB技术讲座(源码+案例+视频)
- Servlet学习笔记(二):Http协议详解
- Py2exe 打包 Python项目(traits、traitsui、matplotlib)
- Sicily 1818. 成绩转换
- MySQL也有小脾气之-------windows无法启动mysql服务
- Quart 2D 绘制图形简单总结
- 集成Hibernate Search做全文检索
- CSS画图小技巧(转载)
- 第17题:X的平方根
- oracle数据库--select单表查询
- HDU 5155 Harry And Magic Box --DP
- Mvc4单点登录之一Cas简单介绍