Page 1 of 3

11223 - O: dah dah dah!

Posted: Sun Jun 10, 2007 11:41 am
by hamedv
Please help me.
what's wrong with my code?!!

Code: Select all

GOT AC

Posted: Sun Jun 10, 2007 12:11 pm
by little joey
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!

Posted: Sun Jun 10, 2007 12:19 pm
by hamedv
Thank you. :D

Posted: Tue Jun 12, 2007 7:06 am
by Seki
I got PE.
What's wrong with my code?
Could anyone help me?

Code: Select all

GOT AC

Posted: Tue Jun 12, 2007 8:25 pm
by ayeshapakhi
ur printing more spaces between words when it is not necessary...

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

Posted: Tue Jun 12, 2007 10:22 pm
by sapnil
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.

Posted: Tue Jun 12, 2007 10:42 pm
by Jan
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.

Posted: Wed Jun 13, 2007 1:49 am
by Seki
Thanks all :D
I've got AC!

Posted: Wed Jun 13, 2007 7:37 pm
by sapnil
My output is similar to your output.But till i get PI.................
More case PLZ...........

sapnil

Posted: Wed Jun 13, 2007 8:00 pm
by Spykaj
Delete trailing spaces from every line.

Posted: Wed Jun 13, 2007 8:04 pm
by Jan
Spykaj wrote:Delete trailing spaces from every line.
Not necessary I think.

Posted: Sat Jun 16, 2007 6:56 am
by sapnil
Finally I got ACC...
But why i don't Know,because i did it before.

sapnil.

Thanks everybody.... Keep posting.

Posted: Sat Jun 16, 2007 12:38 pm
by stubbscroll
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.

Posted: Sat Jun 16, 2007 2:30 pm
by little joey
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.

Re: 11223 - O: dah dah dah!

Posted: Wed Jun 20, 2007 7:06 pm
by spir
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;
}