模拟题,知道字符的ASCII表示。
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<string> names;
LL tran(string s)
{
LL ans = 0;
for (auto ch: s)
ans += (LL)ch - 'A' + 1;
return ans;
}
int main(void)
{
string s;
while(cin >> s)
{
names.push_back(s);
}
sort(names.begin(), names.end());
LL ans = 0;
for (int i = 0; i < names.size(); ++ i)
{
ans += (LL)(i + 1) * tran(names[i]);
}
cout << names[937] << endl;
cout << ans << endl;
return 0;
}