velimir

Zborovi

Mar 23rd, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. struct pole{
  5.     char bukva;
  6.     int vrednost;
  7. };
  8.  
  9. int main()
  10. {
  11.     int i, j, maxi=0, n, tempMaxi=0, l;
  12.     string ime, tempIme, aaa;
  13.     pole azbuka[26];
  14.     for(i=0; i<26; i++)cin >> azbuka[i].bukva >> azbuka[i].vrednost;
  15.     cin >> n;
  16.     for(i=0; i<n; i++)
  17.     {
  18.         cin >> ime;
  19.         for(j=0; j<ime.size(); j++)
  20.             for(l=0; l<26; l++)
  21.             {
  22.                 if(ime[j] == azbuka[l].bukva)tempMaxi+=azbuka[l].vrednost;
  23.                 else if (int(ime[j])==int(azbuka[l].bukva-32)) tempMaxi+=(azbuka[l].vrednost+20);
  24.             }
  25.         if(maxi<tempMaxi){ maxi = tempMaxi; aaa = ime;}
  26.         tempMaxi = 0;
  27.     }
  28.     cout << aaa;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment