11223 - O: dah dah dah!

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

Moderator: Board moderators

hamedv
Learning poster
Posts: 98
Joined: Mon May 07, 2007 8:30 am

11223 - O: dah dah dah!

Post by hamedv » Sun Jun 10, 2007 11:41 am

Please help me.
what's wrong with my code?!!

Code: Select all

GOT AC
Last edited by hamedv on Sun Jun 10, 2007 12:17 pm, edited 1 time in total.

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Sun Jun 10, 2007 12:11 pm

Your 'C' and 'D' look the same to me... there may be more errors.

And another thing: make sure your program produces the sample output for the sample input before posting your code!
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.

hamedv
Learning poster
Posts: 98
Joined: Mon May 07, 2007 8:30 am

Post by hamedv » Sun Jun 10, 2007 12:19 pm

Thank you. :D

Seki
New poster
Posts: 2
Joined: Tue Jun 12, 2007 7:00 am

Post by Seki » Tue Jun 12, 2007 7:06 am

I got PE.
What's wrong with my code?
Could anyone help me?

Code: Select all

GOT AC
Last edited by Seki on Wed Jun 13, 2007 1:45 am, edited 1 time in total.

ayeshapakhi
Learning poster
Posts: 60
Joined: Sun Apr 16, 2006 7:59 pm

Post by ayeshapakhi » Tue Jun 12, 2007 8:25 pm

ur printing more spaces between words when it is not necessary...

make ur ans right for sample i.o ...

sapnil
Experienced poster
Posts: 106
Joined: Thu Apr 26, 2007 2:40 pm
Location: CSE-SUST
Contact:

Post by sapnil » Tue Jun 12, 2007 10:22 pm

I remove extra space till get WR.

what is the output for this input:::

4
ssss.ssss.sss
ssss.ssss.
.sssssssss.
sssssssss.

Note:'s' means sigale space

Thanks..... Keep posting
sapnil.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Tue Jun 12, 2007 10:42 pm

sapnil wrote: Input:

Code: Select all

4
ssss.ssss.sss
ssss.ssss.
.sssssssss.
sssssssss.
Output:

Code: Select all

Message #1
ssEssEs

Message #2
ssEssE

Message #3
EssssE

Message #4
ssssE

Code: Select all

Note: 's' means sigale space
Hope it helps.
Ami ekhono shopno dekhi...
HomePage

Seki
New poster
Posts: 2
Joined: Tue Jun 12, 2007 7:00 am

Post by Seki » Wed Jun 13, 2007 1:49 am

Thanks all :D
I've got AC!

sapnil
Experienced poster
Posts: 106
Joined: Thu Apr 26, 2007 2:40 pm
Location: CSE-SUST
Contact:

Post by sapnil » Wed Jun 13, 2007 7:37 pm

My output is similar to your output.But till i get PI.................
More case PLZ...........

sapnil

User avatar
Spykaj
New poster
Posts: 47
Joined: Sun May 21, 2006 12:13 pm

Post by Spykaj » Wed Jun 13, 2007 8:00 pm

Delete trailing spaces from every line.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Wed Jun 13, 2007 8:04 pm

Spykaj wrote:Delete trailing spaces from every line.
Not necessary I think.
Ami ekhono shopno dekhi...
HomePage

sapnil
Experienced poster
Posts: 106
Joined: Thu Apr 26, 2007 2:40 pm
Location: CSE-SUST
Contact:

Post by sapnil » Sat Jun 16, 2007 6:56 am

Finally I got ACC...
But why i don't Know,because i did it before.

sapnil.

Thanks everybody.... Keep posting.

stubbscroll
Experienced poster
Posts: 151
Joined: Tue Nov 16, 2004 7:23 pm
Location: Norway
Contact:

Post by stubbscroll » Sat Jun 16, 2007 12:38 pm

I had to remove trailing spaces from each output line in order to avoid Presentation error. But then again, that might depend on how the input is read. I don't know the input reading nuances in other languages than C.

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Sat Jun 16, 2007 2:30 pm

My program would surely print extra spaces in such cases, but doesn't get PE.
Maybe the judges input is in DOS format and contains return characters ('\r') at the end of the line. C's isspace() would recognize them as space characters. My program only recognizes real space characters (' ') and ignores all junk, which would explain it.
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.

spir
New poster
Posts: 2
Joined: Wed Jun 20, 2007 6:31 pm

Re: 11223 - O: dah dah dah!

Post by spir » Wed Jun 20, 2007 7:06 pm

Please help me.
what's wrong with my code?!!

Code: Select all

#include <stdio.h>
#include <string.h>

char Symble[53] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
	                'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
				    'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3',
				    '4', '5', '6', '7', '8', '9', ',', '.', '?', '\'',
				    '!', '/', '(', ')', '&', ':', ';', '=', '+', '-',
				    '_', '\"', '@' };

char Code[53][7] = { ".-",     "-...",   "-.-.",  "-..",    ".",     "..-.",   "--.",    "....",   "..",     ".---",
	                 "-.-",    ".-..",   "--",    "-.",     "---",   ".--.",   "--.-",   ".-.",    "...",    "-",
				     "..-",    "...-",   ".--",   "-..-",   "-.--",  "--..",   "-----",  ".----",  "..---",  "...--",
				     "....-",  ".....",  "-....", "--...",  "---..", "----.",  ".-.-.-", "--..--", "..--..", ".----.",
				     "-.-.--", "-..-.",  "-.--.", "-.--.-", ".-...", "---...", "-.-.-.", "-...-",  ".-.-.",  "-....-",
				     "..--.-", ".-..-.", ".--.-." };
char message[11][1000];
int t;

void compare(char s[],int it) {
	int i;
	for(i = 0; i < 53; i++) {
		if(!strcmp(Code[i], s))
			message[it][t++] = Symble[i];
	}
}

int main() {
	int  i, n, m = 0 , flag = 0;
	char ch;
	char tempCode[10];

	scanf("%d", &n);
	for(i = 0; i <= n; i++) {
		while((ch = getchar()) != '\n') {
			if(ch != ' ') {
					tempCode[m++] = ch;
					flag = 0;
			}
			else if(ch == ' ' && flag == 0) {
					tempCode[m] = '\0';
					compare(tempCode, i);
					m = 0;
					flag = 1;
			}
			else if(flag == 1) {
				message[i][t++] = ' ';
				flag = 0;
			}
		}
		tempCode[m] = '\0';
		compare(tempCode, i);
		message[i][t] = '\0';
		t = 0;
		m = 0;
		flag = 0;
	}

	for(i = 1; i <= n; i++) {
		printf("\nMessage #%d\n" , i);
		printf("%s\n", message[i]);
	}
	return 0;
}

Post Reply

Return to “Volume 112 (11200-11299)”