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

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的网站久久看| 午夜综合激情| 亚洲欧美在线x视频| 亚洲影院色在线观看免费| 中文国产亚洲喷潮| 亚洲伊人网站| 欧美一区二区三区久久精品茉莉花 | 欧美成人性网| 欧美大尺度在线观看| 美脚丝袜一区二区三区在线观看| 国产日韩一区在线| 国产精品久久久久久久久久久久久久 | 久久国产精品一区二区| 亚洲免费成人av| 国产精品一区一区| 欧美丰满高潮xxxx喷水动漫| 欧美在线视频一区二区三区| 日韩亚洲欧美一区二区三区| 久久超碰97人人做人人爱| 99精品欧美一区| 久久久精品tv| 日韩午夜电影av| 欧美国产先锋| 亚洲第一久久影院| 国产精品视频成人| 久久av一区二区三区漫画| 欧美成人激情视频| 欧美在线亚洲一区| 女仆av观看一区| 欧美成人情趣视频| 欧美午夜不卡| 亚洲激情婷婷| 亚洲成色www8888| 香蕉久久国产| 亚洲综合色网站| 欧美另类极品videosbest最新版本| 亚洲欧美一区在线| 亚洲激情成人| 亚洲国产成人久久综合一区| 欧美在线一级视频| 国产精品va| 在线视频日韩精品| 亚洲欧美日韩国产综合在线| 欧美三级乱码| 久久久久国产一区二区| 欧美在线视频a| 欧美一区久久| 国产精品入口| 亚洲免费网址| 久久精品五月婷婷| 国内免费精品永久在线视频| 欧美一区二区久久久| 久久九九99视频| 在线观看亚洲a| 久久久久久尹人网香蕉| 久久中文字幕一区| 在线欧美一区| 欧美大尺度在线| 亚洲激情视频在线播放| 一本久久综合亚洲鲁鲁| 欧美日本亚洲视频| 亚洲视频在线一区| 欧美自拍偷拍| 伊人色综合久久天天五月婷| 久久精品夜色噜噜亚洲aⅴ| 久久综合婷婷| 亚洲精品在线免费观看视频| 欧美日韩成人免费| 亚洲欧美三级伦理| 欧美韩日一区二区三区| 中国成人黄色视屏| 国产精品日韩精品| 久久久高清一区二区三区| 免费看精品久久片| 亚洲视频一区二区免费在线观看| 国产精品露脸自拍| 久热精品视频在线观看| 99精品国产99久久久久久福利| 香蕉成人啪国产精品视频综合网| 国产精品毛片高清在线完整版| 亚洲自拍电影| 国产精品99久久久久久久vr | 欧美成人日本| 亚洲欧美偷拍卡通变态| 一区二区三区在线观看视频| 欧美日韩国产成人在线观看| 欧美影院午夜播放| 亚洲经典三级| 久久人人爽人人| 亚洲制服av| 亚洲日韩第九十九页| 国产一区 二区 三区一级| 亚洲国产91色在线| 欧美综合国产| 老鸭窝91久久精品色噜噜导演| 欧美多人爱爱视频网站| 亚洲自啪免费| 99精品视频免费观看视频| 狠狠做深爱婷婷久久综合一区| 欧美人妖另类| 久久综合久久久久88| 亚洲免费小视频| 夜夜嗨av色一区二区不卡| 欧美高清视频www夜色资源网| 欧美一区二区三区视频在线| aa级大片欧美三级| 亚洲黄色成人网| 经典三级久久| 国内精品久久久久久久97牛牛| 欧美日韩一区在线| 欧美精品久久久久久久久久| 狂野欧美激情性xxxx欧美| 午夜视频在线观看一区二区| 亚洲视频999| 一区二区三区欧美亚洲| 久久成人资源| 欧美片在线观看| 欧美福利电影网| 久久综合久久综合久久综合| 午夜精品短视频| 亚洲一区免费视频| 99精品视频免费观看| 99这里有精品| 一本色道久久综合狠狠躁篇的优点| 亚洲第一毛片| 亚洲第一福利视频| 久久精品国产69国产精品亚洲| 亚洲系列中文字幕| 亚洲砖区区免费| 亚洲一级一区| 亚洲已满18点击进入久久| 亚洲一级片在线观看| 夜色激情一区二区| 亚洲精品久久嫩草网站秘色| 欧美wwwwww| 欧美成人在线免费视频| 久久久91精品国产一区二区三区| 欧美一区午夜精品| 亚洲一区二区三区中文字幕在线| 欧美激情视频网站| 欧美日韩hd| 欧美日韩国产欧| 欧美精品一区二区三区蜜桃 | 伊人激情综合| 国产情侣久久| 精品成人一区| 精品福利电影| 在线欧美视频| 亚洲经典自拍| 亚洲视频你懂的| 欧美成年人在线观看| 欧美精品二区| 国产精品一区二区在线观看网站 | 欧美一区二区三区在线看| 欧美一级淫片aaaaaaa视频| 久久riav二区三区| 久久精品国产亚洲a| 欧美大片免费久久精品三p| 农村妇女精品| 日韩写真视频在线观看| 一区二区三区.www| 久久精品国产第一区二区三区| 久久爱另类一区二区小说| 久久综合色一综合色88| 欧美麻豆久久久久久中文| 欧美性视频网站| 亚洲天堂av在线免费| 免费视频一区二区三区在线观看| 欧美成人激情在线| 最新国产成人在线观看| 亚洲精品专区| 亚洲专区一区| 欧美jizzhd精品欧美巨大免费| 欧美国产日韩在线观看| 欧美日韩一区在线播放| 国产欧美亚洲日本| 日韩视频免费大全中文字幕| 亚洲在线观看免费视频| 久久精品国产久精国产思思| 免费观看成人| 亚洲欧美一区二区激情| 久久久久久综合网天天| 欧美国产精品中文字幕| 国产精品福利在线观看| 亚洲国产精品一区二区www|