Huawei Training Topic: Beginner--Name Beauty (failed, display format error)

Source: Internet
Author: User

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.

This topic has been shown to be malformed:

The following is the code submitted :

1#include <iostream>2#include <vector>3#include <string>4#include <map>5 using namespacestd;6 7map<Char,int>ha;8 9 voidSorted (vector<int>&VEC)Ten { One     intlen=vec.size (); A     inttemp; -      for(intI=0; i<len-1; i++) -          for(intj=i+1; j<len;j++) the             if(vec[j]<Vec[i]) -             { -temp=Vec[i]; -vec[i]=Vec[j]; +vec[j]=temp; -             } + } Avector<int> Piaoliangdu (vector<string>&VEC) at { -vector<int>Rev; -vector<int>v; -     intlen=vec.size (); -      for(intI=0; i<len;i++) -     { in         strings=Vec[i]; -          for(string:: Iterator Iter1=s.begin (); Iter1!=s.end (); iter1++) to             if(*iter1<'a'|| *iter1>'Z') +*iter1=*iter1+ +; - ha.clear (); the          for(string:: Iterator Iter1=s.begin (); Iter1!=s.end (); iter1++) *         { $             if(Ha.count (*iter1) = =0)Panax Notoginsengha[*iter1]=1; -             Else theha[*iter1]++; +         } A v.clear (); the          for(map<Char,int>::iterator J=ha.begin (); J!=ha.end (); j + +) +V.push_back (j->second); - Sorted (v); $  $         intdu= -; -         intRe=0; -          for(vector<int>::reverse_iterator J=v.rbegin (); J!=v.rend (); j + +) the         { -Re=re+ (du* (*j));Wuyidu--; the         } - Rev.push_back (re); Wu     } -     returnRev; About } $  - intMain () - { -     intN; Avector<string>Vec; +     strings; theCin>>N; -      while(n--) $     { theCin>>s; the Vec.push_back (s); the     } the  -vector<int> rev=Piaoliangdu (VEC); invector<int>:: iterator i; the      for(I=rev.begin (); I!=rev.end ()-1; i++) thecout<<*i<<' '; Aboutcout<<*i<<Endl; theSystem"Pause"); the  the}

Huawei Training Topic: Beginner--Name Beauty (failed, display format error)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.