|
|
вернуться в форумWhat about 10 test? My program here. #include <cstdlib> #include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; bool compar1(pair<string, int> a, pair<string,int> b) { if (a.second>b.second) return true; else return false; } int main(int argc, char *argv[]) { int n = 0; cin >> n; vector<pair<string, int> > v(n); for (int i = 0; i<n; i++) { string tmp; int num; cin >> tmp; cin >> num; v.push_back(make_pair(tmp, num)); } sort(v.begin(), v.end(), compar1); int m = 0; cin >> m; for (int i = 0; i<m; i++) { string str; cin >> str; for (int j = 0; j<n; j++) { if (v[j].first.find(str)==0&&j<10) { cout << v[j].first << endl; } } if (i!=m-1) cout << endl; } system("PAUSE"); return 0; } |
|
|