artemgf

Конкурс прогнозов

Apr 15th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #define _USE_MATH_DEFINES
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <string>
  5. #include <set>
  6. #include <map>
  7. #include <algorithm>
  8. #include <string>
  9. #include <math.h>
  10. #include <vector>
  11. #include <cmath>
  12.  
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17.     map <string, string> com;
  18.     vector <int> winner;
  19.     int n;
  20.     int ni, sum=0;
  21.  
  22.     for (int i = 1; i <= 12; i++)
  23.     {
  24.         string prom;
  25.         cin >> prom;
  26.         if (i <= 4)
  27.             com.insert(pair <string, string>(prom, "gold"));
  28.         else
  29.             if (i <= 8)
  30.                 com.insert(pair <string, string>(prom, "silver"));
  31.             else
  32.                 com.insert(pair <string, string>(prom, "bronze"));
  33.     }
  34.     cin >> n;
  35.     for (int i = 1; i <= n; i++)
  36.     {
  37.         sum = 0;
  38.         cin >> ni;
  39.         for (int j = 1; j <= ni; j++)
  40.         {
  41.             string prom, prom2;
  42.             cin >> prom;
  43.             cin >> prom2;
  44.             cin >> prom2;
  45.             if (com.find(prom) != com.end())
  46.                 if (com[prom] == prom2)
  47.                     sum++;
  48.         }
  49.         winner.push_back(sum);
  50.     }
  51.  
  52.     sort(winner.begin(), winner.end());
  53.     int prom, prom2;
  54.     prom=winner[winner.size() - 1];
  55.     prom2 = 1;
  56.     for (int i = winner.size() - 2; i >=0; i--)
  57.         if (prom == winner[i])
  58.             prom2 ++;
  59.         else
  60.             break;
  61.  
  62.     cout << prom2*5;
  63.     system("pause");
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment