青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

hdu1075

What Are You Talking About

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others)
Total Submission(s): 6842    Accepted Submission(s): 2086


Problem Description
Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want to translate the history book into English. Can you help him?
 

Input
The problem has only one test case, the test case consists of two parts, the dictionary part and the book part. The dictionary part starts with a single line contains a string "START", this string should be ignored, then some lines follow, each line contains two strings, the first one is a word in English, the second one is the corresponding word in Martian's language. A line with a single string "END" indicates the end of the directory part, and this string should be ignored. The book part starts with a single line contains a string "START", this string should be ignored, then an article written in Martian's language. You should translate the article into English with the dictionary. If you find the word in the dictionary you should translate it and write the new word into your translation, if you can't find the word in the dictionary you do not have to translate it, and just copy the old word to your translation. Space(' '), tab('\t'), enter('\n') and all the punctuation should not be translated. A line with a single string "END" indicates the end of the book part, and that's also the end of the input. All the words are in the lowercase, and each word will contain at most 10 characters, and each line will contain at most 3000 characters.
 

Output
In this problem, you have to output the translation of the history book.
 

Sample Input
START from fiwo hello difh mars riwosf earth fnnvk like fiiwj END START difh, i'm fiwo riwosf. i fiiwj fnnvk! END
 

Sample Output
hello, i'm from mars. i like earth! 好開心,125ms,statistic里面第三,happying……
第二個trie,雖然調了老半天,是些字符串處理的錯誤
wa了兩邊,原因是count是用來判斷有無該單
#include <cstdio>
#include 
<cstdlib>
#include 
<cstring>
#include 
<cmath>
#include 
<ctime>
#include 
<cassert>
#include 
<iostream>
#include 
<sstream>
#include 
<fstream>
#include 
<map>
#include 
<set>
#include 
<vector>
#include 
<queue>
#include 
<algorithm>
#include 
<iomanip>
#define pp printf("here\n")
using namespace std;
struct node
{
    
int next[26];
    
char name[11];
    
int count;
    
void init()
    
{
        memset(next,
-1,sizeof(next));
        count
=0;
    }

}
 s[5000005];
int ind,sind;
void cas_init()
{
    s[
0].init();
    sind
=1;
}

void ins(char str[],char str1[])
{
    
int len=strlen(str);
    
int i,j,ind;
    
for(i=ind=0; i<len; i++)
    
{
        j
=str[i]-'a';
        
if(s[ind].next[j]==-1)
        
{
            s[sind].init();
            s[ind].next[j]
=sind++;
        }

        
//s[ind].count++;
        ind=s[ind].next[j];
    }

    s[ind].count
++;
    len
=strlen(str1);
    
for(i=0; i<len; i++)  s[ind].name[i]=str1[i];
    s[ind].name[len]
='\0';
}

int search(char str[])
{
    
int ind,i,j,len=strlen(str);
    ind
=0;
    
for(i=0; i<len; i++)
    
{
        j
=str[i]-'a';
        
if(s[ind].next[j]==-1)
            
return 0;
        
else ind=s[ind].next[j];
    }

    
return ind;
}

int main()
{
    
int i,j,len,tmp,ai,k;
    cas_init();
    
char str[36],str11[15],strn[15];
    
char str1[1005],str2[10050];
    gets(str);
    
while(gets(str)&&!(strcmp(str,"END")==0)) 
    
{
        len
=strlen(str);
        i
=0;
        
while(i<len&&str[i]!=' '{str11[i]=str[i];i++;}str11[i]='\0';
        i
++;
        j
=i;
        
while(j<len){strn[j-i]=str[j];j++;}strn[j-i]='\0';
    
//    puts(strn);puts(str11);
        ins(strn,str11);

    }

    gets(str);
    
while(gets(str1)&&(strcmp(str1,"END")!=0))
    
{
        len
=strlen(str1);
        i
=0;
        j
=0;
        ai
=0;
        
while(j!=len)
        
{
            
while((str1[i]<'a'||str1[i]>'z')&&(i<len))
            
{
                str2[ai]
=str1[i];
                ai
++;i++;
            }

            j
=i;
            
while(str1[j]<='z'&&str1[j]>='a'&&j<len)
            
{
                strn[j
-i]=str1[j];
                j
++;
            }

            strn[j
-i]='\0';
            i
=j;
            tmp
=search(strn);
            
if(tmp!=0&&s[tmp].count>0)
            
{
                
for(k=0; k<strlen(s[tmp].name); k++)
                
{
                    str2[ai]
=s[tmp].name[k];
                    ai
++;
                }

            }

            
else 
            
{
                
for(k=0;k<strlen(strn);k++)
                
{
                    str2[ai]
=strn[k];
                    ai
++;
                }

            }

        }

        str2[ai]
='\0';
        puts(str2);
    }

    
return 0;
}


posted on 2012-07-16 00:38 jh818012 閱讀(213) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2025年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

導航

統計

常用鏈接

留言簿

文章檔案(85)

搜索

最新評論

  • 1.?re: poj1426
  • 我嚓,,輝哥,,居然搜到你的題解了
  • --season
  • 2.?re: poj3083
  • @王私江
    (8+i)&3 相當于是 取余3的意思 因為 3 的 二進制是 000011 和(8+i)
  • --游客
  • 3.?re: poj3414[未登錄]
  • @王私江
    0ms
  • --jh818012
  • 4.?re: poj3414
  • 200+行,跑了多少ms呢?我的130+行哦,你菜啦,哈哈。
  • --王私江
  • 5.?re: poj1426
  • 評論內容較長,點擊標題查看
  • --王私江
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲高清不卡在线| 亚洲伊人一本大道中文字幕| 香蕉久久夜色| 激情懂色av一区av二区av| 欧美777四色影视在线| 欧美国产激情| 久久国产手机看片| 欧美精品在线观看播放| 午夜一区二区三区在线观看| 久久综合给合久久狠狠狠97色69| aa级大片欧美| 欧美精品18| 国产精品99久久久久久www| 亚洲国产精品va在线看黑人| 性欧美18~19sex高清播放| 久久国产精品99久久久久久老狼 | 久久青草久久| 国产精品一区二区三区观看| 亚洲精品美女91| 欧美精品一区二区三区在线看午夜| 亚洲一卡久久| 久久综合五月天婷婷伊人| 亚洲自拍偷拍一区| 欧美激情第4页| 狂野欧美激情性xxxx| 国产精品婷婷午夜在线观看| 亚洲国产成人精品女人久久久| 国产日韩欧美亚洲| 中文一区二区| 亚洲精品永久免费| 久久综合九色| 另类国产ts人妖高潮视频| 国产毛片精品视频| 一区二区黄色| 中国成人在线视频| 欧美精品福利视频| 欧美成人激情视频| 国外成人在线视频网站| 性视频1819p久久| 午夜激情亚洲| 国产精品国内视频| 亚洲调教视频在线观看| 亚洲在线黄色| 国产精品久久久久久久久| 日韩视频在线观看免费| 一区二区三区www| 欧美日韩国产综合新一区| 亚洲国内精品| 亚洲乱码久久| 欧美日本三级| 一本不卡影院| 亚洲免费在线精品一区| 国产精品wwwwww| 亚洲视频导航| 欧美制服第一页| 国产午夜精品久久久久久久| 午夜国产不卡在线观看视频| 欧美中文字幕| 一区视频在线| 欧美国产在线视频| 日韩视频一区二区三区| 亚洲欧美一区二区三区在线 | 欧美在线视频一区二区| 国产真实久久| 久久只有精品| 亚洲精品一级| 欧美在线视频免费| 亚洲第一精品福利| 亚洲午夜在线| 日韩午夜电影在线观看| 午夜欧美大片免费观看| 欧美激情精品久久久久久免费印度| 妖精视频成人观看www| 欧美激情一区二区三区| 一本色道久久| 久久精品国产欧美激情| 一区三区视频| 欧美美女福利视频| 香蕉成人啪国产精品视频综合网| 麻豆九一精品爱看视频在线观看免费| 亚洲韩国一区二区三区| 欧美手机在线视频| 久久久www成人免费毛片麻豆| 亚洲精品一区二区三| 欧美在线地址| 亚洲三级影片| 国产精品影片在线观看| 免费在线一区二区| 亚洲欧美日韩精品久久奇米色影视| 免费在线观看成人av| 亚洲午夜视频| 136国产福利精品导航网址| 欧美私人啪啪vps| 久久亚洲国产精品一区二区 | 欧美性大战久久久久| 欧美专区福利在线| 亚洲精品欧美极品| 久久久国产一区二区三区| 日韩性生活视频| 国产综合在线看| 欧美性一区二区| 欧美fxxxxxx另类| 午夜精品99久久免费| 亚洲精品一区二区三区婷婷月| 久久久精品一品道一区| 亚洲一级黄色av| 亚洲精品在线视频观看| 极品尤物久久久av免费看| 国产精品免费观看在线| 欧美精品一区二| 快she精品国产999| 欧美一级夜夜爽| 亚洲一区二区视频在线| 亚洲国产视频一区| 久热精品视频在线观看| 香蕉久久久久久久av网站| 一本色道综合亚洲| 亚洲日本成人| 亚洲国产成人久久| 国产一区二区三区日韩| 国产精品欧美久久| 欧美亚州在线观看| 欧美日韩一卡| 欧美日韩国产一区| 欧美精品一区二区三| 欧美www视频在线观看| 久久先锋资源| 久久久免费精品| 久久精品色图| 久久久久久久久久久久久女国产乱| 亚洲欧美日韩国产精品| 亚洲欧美日产图| 欧美一区二区大片| 欧美一区二区三区精品| 欧美一区二区三区在线观看| 亚洲欧美中日韩| 欧美一级播放| 久久精品国产免费看久久精品| 久久黄色小说| 另类国产ts人妖高潮视频| 亚洲成人在线网站| 在线中文字幕一区| 在线视频欧美日韩| 国产精品99久久久久久www| 亚洲午夜av| 午夜精品成人在线| 欧美一区二区三区精品 | 欧美日韩一区二区在线| 欧美日韩国产一区二区三区地区 | 免费观看成人网| 欧美高清视频在线播放| 亚洲高清视频的网址| 亚洲欧洲另类国产综合| 日韩网站在线| 亚洲综合三区| 久久激情视频| 免费国产一区二区| 欧美日本免费一区二区三区| 欧美三级网址| 国产婷婷色综合av蜜臀av | 久久不见久久见免费视频1| 久久狠狠一本精品综合网| 美女主播一区| 欧美三区免费完整视频在线观看| 国产精品日本一区二区| 激情一区二区| 日韩一级不卡| 久久riav二区三区| 欧美顶级少妇做爰| 亚洲久久在线| 欧美一区激情视频在线观看| 男人的天堂成人在线| 国产精品久久二区| 激情久久久久久久| 正在播放日韩| 久久中文久久字幕| 亚洲免费观看视频| 久久电影一区| 欧美日韩三区| 在线看国产日韩| 亚洲在线不卡| 欧美国产成人精品| 亚洲自拍偷拍一区| 欧美国产第二页| 国产一区二三区| 一区二区三区色| 老鸭窝91久久精品色噜噜导演| 亚洲精品黄色| 久久视频国产精品免费视频在线| 欧美日韩精品一区二区天天拍小说| 国产中文一区| 亚洲免费网站| 亚洲精选成人| 免费成人在线观看视频| 国产欧美亚洲精品| 亚洲一区二区三区777| 欧美xart系列在线观看| 欧美一区二区精美| 国产精品va在线| 一本色道久久加勒比88综合|