There's a system function called index, and in C/C++ you can't use the same identifier to name two different things (a function and a variable) in the same scope (global, in this case).So why it conflicts with previous declaration `char* index(const char*, int)' . Its really hard to understand.
10282 - Babelfish
Moderator: Board moderators
Compiler was updated recently. If you want to avoid compilation errors, it's best to download and use gcc.
-
- Learning poster
- Posts: 53
- Joined: Sat Jul 29, 2006 7:33 am
- Location: (CSE,DU), Dhaka,Bangladesh
post reply
Dear mf,
Thank you very much. But its WA now. What can i do?
Here is my code
thanks.
Thank you very much. But its WA now. What can i do?
Here is my code
Code: Select all
the code is removed
No venture no gain
with best regards
------------------------
ishtiaq ahmed
with best regards
------------------------
ishtiaq ahmed
-
- Experienced poster
- Posts: 162
- Joined: Thu Jul 13, 2006 7:07 am
- Location: Campus Area. Dhaka.Bangladesh
- Contact:
Re: 10282 - Babelfish
Thank You.
It was really a chilly mistake.
keep posting.
It was really a chilly mistake.
Code: Select all
Accepted
Last edited by newton on Fri Jul 04, 2008 12:25 pm, edited 1 time in total.
http://www.newton.0fees.net is enough!
Re: 10282 - Babelfish
newton wrote:why Compilation Error?
And also say is my algorithm correct? will the code be accepted after correction?
Try this..
Code: Select all
int comp(const void *a,const void *b) {
Code: Select all
int binSearch(char *p,int n){
Binary search is a correct algorithm to solve this problem..
Remove your code after AC
Re: 10282 - Babelfish
Last edited by jahin on Fri Oct 24, 2008 4:40 am, edited 1 time in total.
-
- Experienced poster
- Posts: 162
- Joined: Thu Jul 13, 2006 7:07 am
- Location: Campus Area. Dhaka.Bangladesh
- Contact:
Re: 10282 - Babelfish
jahin wrote:
remove ur AC code please
if it isgot ac
remove ur AC code please
http://www.newton.0fees.net is enough!
-
- New poster
- Posts: 19
- Joined: Fri Sep 05, 2008 6:39 pm
- Location: bangladesh
- Contact:
Re: 10282 - Babelfish
I am getting WA.....Where is the problem?
Code: Select all
#include<iostream>
#include<map>
#include<string>
using namespace std;
map<string,int>M;
typedef struct{
char final[205];
}data;
data A[100005];
int main(){
int i,cnt,j,k;
char str[205],tempa[200],tempb[200];
//freopen("i.txt","r",stdin);
cnt=0;
while(gets(str)){
if(!strcmp(str,""))
break;
i=0;
while(1){
if(str[i]==' ')
break;
i++;
}
for(j=0;j<i;j++)
tempa[j]=str[j];
tempa[j]='\0';
strcpy(A[cnt].final,tempa);
for(k=0,j=i+1;str[j];j++,k++)
tempb[k]=str[j];
tempb[k]='\0';
M[tempb]=cnt;
cnt++;
memset(tempa,NULL,sizeof(tempa));
memset(tempb,NULL,sizeof(tempb));
memset(str,NULL,sizeof(str));
}
while(gets(str)){
if(M[str]){
printf("%s\n",A[M[str]].final);
}
else
printf("eh\n");
}
return 0;
}
-
- Experienced poster
- Posts: 110
- Joined: Tue May 06, 2008 2:18 pm
- Location: CSE-DU, Bangladesh
- Contact:
Re: 10282 - Babelfish
so? everyone forgot about the TRIE ????
You should not always say what you know, but you should always know what you say.
Re: 10282 - Babelfish
Last edited by sith on Thu Jun 28, 2012 10:11 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10282 - Babelfish
Use a map, not a hashCode.
Check input and AC output for thousands of problems on uDebug!
Re: 10282 - Babelfish
Thank you. It works
-
- New poster
- Posts: 30
- Joined: Thu Jul 19, 2012 11:24 pm
Re: 10282 - Babelfish
Code: Select all
ACCEPTED
Last edited by kier.guevara on Mon Feb 11, 2013 2:33 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10282 - Babelfish
Try using a map.
Check input and AC output for thousands of problems on uDebug!