【PAT甲级】1022. Digital Library (30)
来源:互联网 发布:淘宝消保金怎么退 编辑:程序博客网 时间:2024/06/06 16:33
#include <iostream>#include <iomanip>#include <sstream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <string>#include <map>#include <set>using namespace std;int n;int m;map<string, set<int> > lib[6];int main(int argc, char *argv[]) { int i, j, k; cin >> n; int count = 0; for (i = 0; i < n; i++) { int id; cin >> id; getchar();//把缓冲中的回车清除掉 for (j = 1; j < 6; j++) { string line; if (j != 3) { getline(cin, line); string atr = line.c_str(); lib[j][atr].insert(id); } else { getline(cin, line); istringstream iss(line); string key; while (iss >> key) { lib[j][key].insert(id); } } } } cin >> m; for (i = 0; i < m; i++) { int num; scanf("%d: ", &num); string s; getline(cin, s); cout <<num << ": " << s << endl; if (lib[num].find(s) == lib[num].end()) { cout << "Not Found" << endl; continue; } for (set<int>::iterator it = lib[num][s].begin(); it != lib[num][s].end(); it++) { cout.fill('0'); cout << setw(7) << *it << endl; } } return 0;}
0 0
- 【PAT甲级】1022. Digital Library (30)
- 1022. Digital Library (30)PAT甲级
- PAT甲级练习1022. Digital Library (30)
- PAT甲级1022. Digital Library (30)
- PAT 甲级 1022. Digital Library (30)
- [PAT-甲级]1022.Digital Library
- 1022. Digital Library (30)-PAT甲级真题
- PAT甲级练习题A1022. Digital Library (30)
- PAT 甲级 1022. Digital Library(map,读取标准输入)
- PAT 1022. Digital Library (30)
- pat 1022. Digital Library (30)
- PAT 1022. Digital Library (30)
- PAT 1022. Digital Library (30)
- PAT 1022. Digital Library (30)
- 【PAT】1022. Digital Library (30)
- [pat]1022. Digital Library (30)
- 1022. Digital Library (30)-PAT甲级真题(map映射)
- pat 1022. Digital Library
- log4j配置文件详解
- 泛型程序设计
- 线段树模板
- http://www.zhihu.com/question/20790576
- 2013 Asia Regional Changchun HDU - 4814 Golden Radio Base (进制模拟)
- 【PAT甲级】1022. Digital Library (30)
- Dubbo高级篇4
- Android Manager
- Android HandlerThread全面解析
- 喜欢的节目
- 云计算术语(二):bare metal environment
- 不定长数组 vector
- K短路及其模板(A*+Dijkstra)
- 解析framework-res.apk中resources.arsc, 更改值实现修改屏幕最低亮度