题目1014:排名
来源:互联网 发布:三国志9优化伴侣设置 编辑:程序博客网 时间:2024/05/21 11:05
////// 有bug。。一直AC不了,求大佬指教///#include <stdio.h>#include <iostream>#include <stack>#include <string.h>#include <queue>#include <cmath>#include <vector>#include <algorithm>#include <map>#include <set>#include <string>using namespace std;typedef long long LL;bool cmp(pair<string, int> a, pair<string, int> b){ if(a.second != b.second){ return a.second > b.second; }else { return a.first < b.first; }}int main() { freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); int N, M, GradeLine; while(scanf("%d",&N) != EOF) { if(N == 0){ break; } scanf("%d %d",&M, &GradeLine); vector<int> Grade; map<string, int> mapp; for(int i = 0; i < M; i++){ int temp; cin >> temp; Grade.push_back(temp); } int K = 0; for(int i = 0; i < N; i++){ string str; int temp, ans = 0; cin >> str >> temp; for(int i = 0; i < temp; i++){ int T; cin >> T; ans += Grade[T - 1]; } if(ans >= GradeLine){ mapp[str] = ans; K++; } } cout << mapp.size() << endl; vector<pair<string, int> > v(mapp.begin(), mapp.end()); sort(v.begin(), v.end(), cmp); vector<pair<string, int> >::iterator iter; for(iter = v.begin(); iter != v.end(); iter++){ cout << iter -> first << " " << iter -> second << endl; } } return 0;}
阅读全文
0 0
- 题目1014:排名
- 题目1014:排名
- 题目1014:排名
- 题目1014:排名
- 题目1014:排名
- 题目1014:排名
- 题目1014:排名
- 题目1014:排名
- 题目1014:排名
- 九度 题目1014:排名
- 九度OJ 题目1014:排名
- 九度OJ题目1014:排名
- 九度OJ题目1014:排名
- 九度OJ:题目 1014 排名
- 九度OJ-题目1014 排名
- 题目1014:排名 九度OJ
- hdu 题目1236 排名
- HDU 题目1236 排名
- Android视频播放器屏幕左侧边随手指上下滑动亮度调节变暗变亮原理实现
- js函数(上)
- Java单例模式详解
- 不需要引用任何jar包的Excel导出实现
- ELK+kafka集成
- 题目1014:排名
- DNS隧道的搭建
- TCP协议的可靠性传输,流量、拥塞控制
- SQlite数据库的C编程接口(五) 便捷函数(Convenience Functions) ——《Using SQlite》读书笔记
- C++Primer Plus(第六版) 第十一章 第七题
- 复习一下冒泡排序和其改进
- 欢迎使用CSDN-markdown编辑器
- LSTM+CRF介绍
- Fragment+ViewPager实现真正的懒加载