Input示例
dad
Output示例
77
#include "bits/stdc++.h"using namespace std;#define LL long long#define INF 0x3f3f3f3f3f#define PI acos(-1)#define N 10010#define MOD 10using namespace std;char str[N];mapm;vector v;int main(){ int n,t; while(~scanf("%s",str)){ m.clear(); v.clear(); int len=strlen(str); for(int i=0;i second); } sort(v.begin(),v.end(),greater ()); for(__typeof(v.begin())it=v.begin();it!=v.end();it++){ ans+=(k--)*(*it); } printf("%d\n",ans); } return 0;}