Babelfish,babelfishpoj
題目連結
- 簡單的字串HASH題目,關鍵學習一下黑書的字串elfhash
const int MAXN = 100010;const int maxn=1000000;const int maxm=100003;const int maxlen=20;class hash{ private: struct node{ char ch[maxlen]; int ptr; node* next; }; node *h[maxm],s[maxn]; int numptr; int Hash(char *key) { unsigned long h=0,g; while(*key) { h=(h<<4)+*key++; g=h&0xf0000000L; if(g)h^=g>>24; h&=~g; } return h%maxm; } public: void init() { int i; for(i=0;i<maxm;i++)h[i]=NULL; numptr=0; } int ins(char ch[]) { int temp=Hash(ch); strcpy(s[numptr].ch,ch); s[numptr].next=h[temp]; s[numptr].ptr=numptr; h[temp]=&s[numptr]; numptr++; return numptr-1; } int question(char ch[]) { int temp=Hash(ch); node* ptr=h[temp]; while(ptr) { if(strcmp(ptr->ch,ch)==0) { return ptr->ptr; } ptr=ptr->next; } return -1; }} hash;char ipt[30], a[20], b[20];char ans[MAXN][20];int main (){ hash.init(); while (gets(ipt) && ipt[0] != 0) { sscanf(ipt, "%s %s", a, b); int hs = hash.ins(b); strcpy(ans[hs], a); } while (gets(ipt) && ipt[0] != 0) { int hs = hash.question(ipt); if (hs != -1) printf("%s\n", ans[hs]); else puts("eh"); } return 0;}/*dog ogdaycat atcaypig igpayfroot ootfrayloops oopslayatcayittenkayoopslaySample Outputcatehloops*/
巴別魚 英語是什東東
巴別魚私人外語學習系統(BabelFish Language Learning System)是一個使學習者能夠隨時隨地、輕鬆快樂地學習並真正能夠掌握運用一門語言的學習系統。 巴別魚這個名稱來自於道格拉斯·亞當斯的《銀河系漫遊指南》系列小說,它是一個能協助人聽懂任意一種語言的虛構物種:
巴別魚體型很小,黃色,外形像水蛭,很可能是宇宙中最奇異的事物。它靠接收腦電波的能量為生,並且不是從其攜帶者身上接收,而是從周圍的人身上。它從這些腦電波能量中吸收所有未被人察覺的精神頻率,轉化成營養。然後他向攜帶者的思想中排泄一種由被感覺到的精神頻率和大腦語言中樞提供的神經訊號混合而成的心靈感應矩陣。所有這些過程的實際效果就是,如果你把一條巴別魚塞進耳朵,你就能立刻理解以任何形式的語言對你說的任何事情,你所聽到的解碼訊號就是巴別魚向你的思想提供的腦電波矩陣。
哪個線上翻譯比較好用?
GOOGLE和雅虎都一般
你可以再看看Babel Fish Translation網址是babelfish.altavista也還可以