HDU Computer College College Student Program Design Contest (1008) Study Words

Source: Internet
Author: User

Test instructions

Enter an article that outputs up to 10 words

Does not include existing words in old

The same number of occurrences by dictionary order size

Simple simulation, number of map records

There's no pit.

and sort it out.

Use String to compare dictionary order sizes directly

#include <cstdio>#include<cstring>#include<string>#include<iostream>#include<algorithm>#include<map>#include<math.h>using namespacestd;Chars[205],m[]={"</article>"};structnode{stringA; intv;} p[150005];BOOLCMP (node A,node b) {if(A.V==B.V)returna.a<C.A; returnA.v>B.V;}intMain () {intI,j,n; intT; scanf ("%d",&T);  while(t--) {scanf ("%s", s); Map<string,int>F;  while(SCANF ("%s", s)) {            intL=strlen (s);  for(i=0; i<l;i++)            {                if(s[i]>='A'&&s[i]<='Z') s[i]+= +; }            if(s[0]=='<') Break; f[s]=-1; } scanf ("%s", s); intCnt=0;  while(SCANF ("%s", s)) {            intL=strlen (s); if(l==Ten)            {                 for(i=0; i<l;i++)                {                    if(S[i]==m[i])Continue;  Break; }                if(i==Ten) Break; }            stringtp="";  for(i=0; i<l;i++)            {                if(s[i]>='A'&&s[i]<='Z') s[i]+= +; if(s[i]>='a'&&s[i]<='Z') TP+=S[i]; Else                {                    if(tp=="")Continue; if(f[tp]==0) {F[TP]=++CNT; P[CNT].A=TP; P[CNT].V=1; }                    ElseP[F[TP]].V++; TP=""; }            }            if(tp=="")Continue; if(f[tp]==0) {F[TP]=++CNT; P[CNT].A=TP; P[CNT].V=1; }                    ElseP[F[TP]].V++; } sort (P+1, p+1+cnt,cmp);  for(i=1; i<=Ten&&i<=cnt;i++) cout<<p[i].a<<Endl; cout<<Endl; }    return 0;}

  

HDU Computer College College Student Program Design Contest (1008) Study Words

Related Article

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: info-contact@alibabacloud.com 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.