1 //12345.cpp:defines the entry point for the console application.2 //3 4#include"stdafx.h"5 6#include <iostream>7#include <string>8#include <algorithm>9#include <vector>Ten One using namespacestd; A - intMainvoid) - { the intN; - - while(cin>>N) - { + - int*p =New int[N]; + stringstr; A for(intj=0; j<n;++j) at { -Cin>>str; -vector<int> Hash ( -,0); - for(intI=0; i < str.length (); + +i) - { -hash[str[i]-'a']++; in } - sort (Hash.begin (), Hash.end ()); top[j]=0; + intCount= -; - for(vector<int>::iterator It=hash.end ()-1; it >= Hash.begin ();--it) the { *p[j]=p[j]+ (count--) * (*it); $ }Panax Notoginseng } - for(intk=0; k<n;++k) the { +cout<<p[k]<<Endl; A } the Delete[] p; + } - $ return 0; $}
Describe |
Give a name that consists of 26 strings, which defines the "beauty" of the string as the sum of all its letters "beauty". Each letter has a "pretty degree", ranging from 1 to 26. No two letters have the same "beauty degree". Letters Ignore case. Give multiple names to calculate the maximum possible "beauty" for each name. |
Knowledge points |
String |
Run time limit |
0M |
Memory limit |
0 |
Input |
An integer n, followed by n names n A string, each representing a name |
Output |
Each name may be the most beautiful degree |
Sample input |
2 Zhangsan Lisi |
Sample output |
192 101 |
The beauty of the name