12250 - Language Detection

All about problems in Volume 122. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
Pro.metal
New poster
Posts: 9
Joined: Fri Dec 17, 2010 8:13 pm

12250 - Language Detection

Post by Pro.metal » Wed Sep 14, 2011 3:02 pm

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 :)

Muftee_Ruet
New poster
Posts: 10
Joined: Fri Sep 16, 2011 6:36 am

Re: WA in Language Detection 12250

Post by Muftee_Ruet » Fri Sep 16, 2011 6:49 am

print "UNKNOWN" for other languages.

Pro.metal
New poster
Posts: 9
Joined: Fri Dec 17, 2010 8:13 pm

Re: WA in Language Detection 12250

Post by Pro.metal » Fri Sep 16, 2011 1:45 pm

Stil getting WA.

shall i just print UNKNOWN without cases number? if yes, then shall the cases number increment?

Singham_CUET
New poster
Posts: 1
Joined: Fri Jan 13, 2012 10:42 am

12250

Post by Singham_CUET » Sat Jan 28, 2012 12:37 pm

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;
}

esharif
New poster
Posts: 18
Joined: Sun Jun 03, 2012 11:56 pm

12250 - Language Detection

Post by esharif » Tue Jun 19, 2012 10:33 pm

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;
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: Why WA for the problem 12250

Post by brianfry713 » Tue Jun 19, 2012 11:35 pm

Print the case number if the language is UNKNOWN.
Check input and AC output for thousands of problems on uDebug!

esharif
New poster
Posts: 18
Joined: Sun Jun 03, 2012 11:56 pm

Re: Why WA for the problem 12250

Post by esharif » Wed Jun 20, 2012 3:49 pm

Thnx a lot. I've got AC finally, though the problem was submitted :lol: 23 times.

Post Reply

Return to “Volume 122 (12200-12299)”