-
Notifications
You must be signed in to change notification settings - Fork 0
/
22.cpp
39 lines (37 loc) · 822 Bytes
/
22.cpp
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
38
39
#include <vector>
#include <string>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
string get;
vector <string> s;
vector <string> :: iterator IT;
void Analysis()
{
for(int i = 0 ; i < strlen(get.c_str()); i ++){
int jump = 1;
if(get[i] == '"')
while(get[i + jump] != '"') jump ++;
s.push_back(get.substr(i + 1, jump - 1));
i += jump + 1;
}
}
int main()
{
freopen("data.in","r",stdin);
//freopen("data.out","w",stdout);
ios::sync_with_stdio(false);
cin >> get;
Analysis(); sort(s.begin(), s.end());
unsigned long long sum = 0;
for(int i = 0; i < (int)s.size(); i ++){
string cur = s[i]; int tot = 0;
for(int j = 0; j < cur.size(); j ++)
tot += cur[j] - 'A' + 1;
sum += tot * (i + 1);
}
cout << sum << endl;
}