HDU 1075 what are you talking about

Source: Internet
Author: User

Dictionary tree

According to the Question Bank, this is a dictionary tree, but I have passed the water.


The meaning is to use the corresponding dictionary to translate the fire text.


Each line will contain at most 3000 characters.

I feel at ease when I see this sentence.Time Limit: 10000/5000 MS (Java/Others)

Make sure you use map. Actually AC. 3296 Ms. I wanted to consolidate the dictionary tree, .......


#include<cstdio>#include<cstring>#include<string>#include<queue>#include<algorithm>#include<queue>#include<map>#include<stack>#include<iostream>#include<list>#include<set>#include<cmath>#define INF 0x7fffffff#define eps 1e-6using namespace std;map<string,string>word;int main(){    string a,b;    word.clear();    while(cin>>a,a!="START");    while(cin>>a,a!="END")    {        cin>>b;        word[b]=a;    }    while(cin>>a,a!="START");    char str[3001];    gets(str);    while(gets(str))    {        if(strcmp(str,"END")==0)return 0;        int len=strlen(str);        char s[3001],j=0;        for(int i=0;i<len;i++)        {            if(str[i]>='a'&&str[i]<='z')                s[j++]=str[i];            else            {                s[j]='\0';j=0;                b=s;                if(word.find(b)==word.end())                    cout<<b;                else                    cout<<word[b];                printf("%c",str[i]);            }        }        printf("\n");    }}


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.