Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- struct pole{
- string x;
- double y;
- };
- bool proverka(pole a, pole b)
- {
- return a.y < b.y;
- }
- int main()
- {
- int brZbor, i, j;
- cin >> brZbor;
- pole zbor[brZbor];
- for(i=0; i<brZbor; i++)
- {
- cin >> zbor[i].x;
- zbor[i].y=0;
- for(j=0; j<zbor[i].x.length(); j++)
- zbor[i].y += zbor[i].x[j] -'A'+1;
- zbor[i].y/=zbor[i].x.length();
- }
- stable_sort(zbor, zbor + brZbor, proverka);
- for(i=0; i<brZbor; i++)
- {
- cout << zbor[i].x << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment