求the largest possible value of the resulting string DZY could get。
那么,求出最大的字母,后面都填充它即可。
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<iomanip>
#include<stdlib.h>
#include<ctype.h>
#include<algorithm>
#include<deque>
#include<functional>
#include<iterator>
#include<vector>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#define CPY(A, B) memcpy(A, B, sizeof(A))
typedef long long LL;
typedef unsigned long long uLL;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double OO = 1e20;
const double PI = acos (-1.0);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
char s[1005]; int a[28];
int main() {
int n,sum=0;
scanf ("%s %d",s,&n);//cout<<s<<n;
for (int i=0; i<26; i++) {
scanf ("%d",&a[i]);
}
int len =strlen (s);
for (int i=0; i<len; i++) {
sum+= (i+1) *a[s[i]-'a'];
}
int maxn=a[0];
for (int i=1; i<26; i++) {
if (a[i]>maxn) { maxn=a[i]; }
}
for (int i=len+1; i<len+n+1; i++) {
sum+=i*maxn;
}
printf ("%d\n",sum);
return 0;
}