Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void solve()
- {
- vector <pair<string, unordered_set <string>>> tap = {
- {"be",{}},
- {"de",{}},
- {"en",{}},
- {"fr",{}},
- {"hy",{}},
- {"it",{}},
- {"ka",{}},
- {"ru",{}},
- {"sv",{}},
- {"uk",{}},
- };
- ifstream fin;
- for (int i = 0; i < 10; ++i)
- {
- string direct = "D:/Everything_for_your_code/Programs/MOSH/C/C-training-set/";
- direct += tap[i].first + '/';
- for (int c = 1; c <= 100; ++c){
- string path = direct;
- string add = to_string(c);
- path += add + ".txt";
- fin.open(path);
- string a;
- while (fin >> a){
- tap[i].second.insert(a);
- }
- fin.close();
- }
- }
- ofstream fout("D:/Everything_for_your_code/Programs/MOSH/C/answer2.txt");
- string direct = "D:/Everything_for_your_code/Programs/MOSH/C/C2/";
- for (int i = 1; i <= 1000; ++i){
- string path = direct;
- string add = to_string(i);
- path += add + ".txt";
- fin.open(path);
- map <string, int> answer;
- string a;
- while (fin >> a){
- for (int q = 0; q < 10; ++q){
- if (tap[q].second.find(a) != tap[q].second.end()){
- answer[tap[q].first]++;
- }
- }
- }
- fin.close();
- long long ans = 0;
- string ans_;
- for (auto q: answer){
- if (q.second > ans){
- ans = q.second;
- ans_ = q.first;
- }
- }
- fout << ans_ << endl;
- }
- cout << "Good bye!!!";
- }
- int main()
- {
- ios_base :: sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- try{
- solve();
- } catch (...){
- cout << "Compile error";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement