芍药种子的英文子翻译子英语怎么说-安徽水利水电职业技术学院地址
2023年10月10日发(作者:席慕容 青春)
[ACM][算法基础]POJ2503在线翻译Babelfish(⼆分查找字符串)
描述
You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language.
Fortunately, you have a dictionary to help you understand them.
输⼊
Input consists of up to 100,000 dictionary entries, followed by a blank line, followed by a message of up to 100,000 words.
Each dictionary entry is a line containing an English word, followed by a space and a foreign language word. No foreign word
appears more than once in the dictionary. The message is a sequence of words in the foreign language, one word on each
#include
#include
#include
#include
#include
using namespace std;
struct Entry
{
char ENG[11];//English
char FOG[11];//外语Foreign
}entry1[100005];
int Cmp(Entry a,Entry b)
{
return strcmp(,)<0;
}
void binarySearch(Entry entry1[100005],int n,char word[])
{
int mid,L=0,R=n-1;
int f=0;
while(R>=L)
{
mid=L+(R-L)/2;
f=strcmp(entry1[mid].FOG,word);
if(f<0)
L=mid+1;
else if(f>0)
R=mid-1;
else if(f==0)
{
printf("%sn",entry1[mid].ENG);
break;
}
}
if(f!=0) printf("ehn");
}
int main()
{
//freopen("","r",stdin);
int n=0;
while(1)
{
scanf("%s%s",entry1[n].ENG,entry1[n].FOG);
n++;
();
if(()=='n') break;
}
sort(entry1,entry1+n,Cmp);
char word[11];
while(~scanf("%s",word))
{
binarySearch(entry1,n,word);
}
return 0;
}
Lige是什么意思e在线翻译读音例句-少儿英语口语教材
芍药种子的英文子翻译子英语怎么说-安徽水利水电职业技术学院地址
2023年10月10日发(作者:席慕容 青春)
[ACM][算法基础]POJ2503在线翻译Babelfish(⼆分查找字符串)
描述
You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language.
Fortunately, you have a dictionary to help you understand them.
输⼊
Input consists of up to 100,000 dictionary entries, followed by a blank line, followed by a message of up to 100,000 words.
Each dictionary entry is a line containing an English word, followed by a space and a foreign language word. No foreign word
appears more than once in the dictionary. The message is a sequence of words in the foreign language, one word on each
#include
#include
#include
#include
#include
using namespace std;
struct Entry
{
char ENG[11];//English
char FOG[11];//外语Foreign
}entry1[100005];
int Cmp(Entry a,Entry b)
{
return strcmp(,)<0;
}
void binarySearch(Entry entry1[100005],int n,char word[])
{
int mid,L=0,R=n-1;
int f=0;
while(R>=L)
{
mid=L+(R-L)/2;
f=strcmp(entry1[mid].FOG,word);
if(f<0)
L=mid+1;
else if(f>0)
R=mid-1;
else if(f==0)
{
printf("%sn",entry1[mid].ENG);
break;
}
}
if(f!=0) printf("ehn");
}
int main()
{
//freopen("","r",stdin);
int n=0;
while(1)
{
scanf("%s%s",entry1[n].ENG,entry1[n].FOG);
n++;
();
if(()=='n') break;
}
sort(entry1,entry1+n,Cmp);
char word[11];
while(~scanf("%s",word))
{
binarySearch(entry1,n,word);
}
return 0;
}