1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <iostream>
#include <algorithm>
using namespace std;
int n;
char azb[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int vred[26];
string a;
int s=0;
int getpos(char _find)
{
int pos=-1;
for(int i=0; i<=25; i++) if(azb[i]==_find) pos=i;
return pos;
}
int main()
{
cin >> n;
string ime[n];
//polnenje na vred
for(int i=0; i<=25; i++) vred[i]=i+1;
//main
for(int j=0; j<=n-1; j++)
{ s=0;
cin >> a;
for(int i=0; i<=a.length()-1; i++)
{
int pos=getpos(a[i]);
s=s+vred[pos];
}
}
// do the sorting
// print the sorted list
return 0;
}
|