国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

1022. Digital Library (30)

2019-11-11 05:40:22
字體:
供稿:網(wǎng)友

map<string,vector<string>>來存儲(chǔ)各個(gè)條件下的id,輸入完成后,對(duì)要輸出的map的second即vector進(jìn)行排序,然后輸出即可 對(duì)于關(guān)鍵詞先getline讀取一行,然后用stringstream重新輸入到string 如果用int來存儲(chǔ)id的話,輸出的時(shí)候000000顯示為0,輸出需要設(shè)置格式

#include<iostream>#include<sstream>#include<string>#include<map>#include<vector>#include<algorithm>using namespace std;#PRagma warning (disable:4996)map<string, vector<string>> one, two, three, four, five;int main(){ //freopen("0.txt", "w", stdout); int N; cin >> N; for (int t = 0;t < N;t++) { string id; cin >> id; getchar(); string str; getline(cin, str); one[str].push_back(id); getline(cin, str); two[str].push_back(id); stringstream ss; getline(cin, str); ss.str(str); while (!ss.eof()) { ss >> str; three[str].push_back(id); } getline(cin, str); four[str].push_back(id); getline(cin, str); five[str].push_back(id); } cin >> N; getchar(); for (int t = 0;t < N;t++) { string str,str2; getline(cin, str); str2.insert(str2.end(),str.begin() + 3, str.end()); cout << str<<endl; switch (str[0]) { case '1': if (one[str2].empty()) cout << "Not Found" << endl; sort(one[str2].begin(), one[str2].end()); for (auto x : one[str2]) cout << x << endl; break; case '2': if (two[str2].empty()) cout << "Not Found" << endl; sort(two[str2].begin(), two[str2].end()); for (auto x : two[str2]) cout << x << endl; break; case '3': if (three[str2].empty()) cout << "Not Found" << endl; sort(three[str2].begin(), three[str2].end()); for (auto x : three[str2]) cout << x << endl; break; case '4': if (four[str2].empty()) cout << "Not Found" << endl; sort(four[str2].begin(), four[str2].end()); for (auto x : four[str2]) cout << x << endl; break; case '5': if (five[str2].empty()) cout << "Not Found" << endl; sort(five[str2].begin(), five[str2].end()); for (auto x : five[str2]) cout << x << endl; break; } }}
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 南木林县| 卢龙县| 永修县| 莲花县| 孟州市| 陆丰市| 神木县| 昂仁县| 龙里县| 禄劝| 仁布县| 交城县| 灌阳县| 保康县| 缙云县| 方城县| 临沭县| 金湖县| 若羌县| 巫山县| 永善县| 铅山县| 灵丘县| 邓州市| 六枝特区| 吉林市| 贵州省| 合山市| 宁远县| 都匀市| 洛隆县| 甘孜| 普兰店市| 鹤岗市| 顺平县| 盐津县| 布拖县| 渭源县| 黑山县| 星子县| 秦皇岛市|