Page 1 of 1
12250 - Language Detection
Posted: Wed Sep 14, 2011 3:02 pm
by Pro.metal
For some unknown reasons, I'm getting WA in this problem.
Can anybody explain what may be the possible reasons of getting WA in this problem?
Thanks

Re: WA in Language Detection 12250
Posted: Fri Sep 16, 2011 6:49 am
by Muftee_Ruet
print "UNKNOWN" for other languages.
Re: WA in Language Detection 12250
Posted: Fri Sep 16, 2011 1:45 pm
by Pro.metal
Stil getting WA.
shall i just print UNKNOWN without cases number? if yes, then shall the cases number increment?
12250
Posted: Sat Jan 28, 2012 12:37 pm
by Singham_CUET
I got time limit...here is my code.can anybody help me to fix it?
Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
int i;
char a[15];
i=1;
while(1)
{
gets(a);
if(a[0]=='#'&&a[1]=='\0')
break;
else if(strcmp(a,"HELLO")==0)
printf("Case %d: ENGLISH",i);
else if(strcmp(a,"HOLA")==0)
printf("Case %d: SPANISH",i);
else if(strcmp(a,"HALLO")==0)
printf("Case %d: GERMAN",i);
else if(strcmp(a,"BONJOUR")==0)
printf("Case %d: FRENCH",i);
else if(strcmp(a,"CIAO")==0)
printf("Case %d: ITALIAN",i);
else if(strcmp(a,"ZDRAVSTVUJTE")==0)
printf("Case %d: RUSSIAN",i);
else printf("Case %d: UNKNOWN",i);
i++;
getchar();
}
return 0;
}
12250 - Language Detection
Posted: Tue Jun 19, 2012 10:33 pm
by esharif
Code: Select all
:oops:
#include<stdio.h>
#include<string.h>
#define max 16
int main()
{
int i=0;
char str[max];
while(scanf("%s",&str)==1 && strcmp(str,"#")!=0)
{
if(strcmp(str,"HELLO")==0)
printf("Case %d: ENGLISH\n",++i);
else if(strcmp(str,"HOLA")==0)
printf("Case %d: SPANISH\n",++i);
else if(strcmp(str,"HALLO")==0)
printf("Case %d: GERMAN\n",++i);
else if(strcmp(str,"BONJOUR")==0)
printf("Case %d: FRENCH\n",++i);
else if(strcmp(str,"CIAO")==0)
printf("Case %d: ITALIAN\n",++i);
else if(strcmp(str,"ZDRAVSTVUJTE")==0)
printf("Case %d: RUSSIAN\n",++i);
else
printf("UNKNOWN\n");
}
return 0;
}
Re: Why WA for the problem 12250
Posted: Tue Jun 19, 2012 11:35 pm
by brianfry713
Print the case number if the language is UNKNOWN.
Re: Why WA for the problem 12250
Posted: Wed Jun 20, 2012 3:49 pm
by esharif
Thnx a lot. I've got AC finally, though the problem was submitted

23 times.