Page 2 of 3

Posted: Fri Jun 22, 2007 6:38 pm
by hamedv
try this :
Input:

Code: Select all

1
.-.b.-.bb.-.
Note : b = blank ' '

Correct Output:

Code: Select all

Message #1
RR R

Your Code Output:

Code: Select all

Message #1
R R  R

Posted: Wed Jun 27, 2007 1:27 pm
by spir
I have try this Input

but get correct Output :(

not this Ootput

Code: Select all

Message #1
R R  R
hamedv wrote:try this :
Input:

Code: Select all

1
.-.b.-.bb.-.
Note : b = blank ' '

Correct Output:

Code: Select all

Message #1
RR R

Your Code Output:

Code: Select all

Message #1
R R  R

Posted: Sat Jul 07, 2007 9:48 pm
by Rocky
to spir:

if u still not get ac then check u'r initialize array code[][] it have some wrong....

GOOD LUCK
Rocky

Posted: Sat Jul 14, 2007 7:42 am
by RC's
How about my code ?

Code: Select all

removed (get AC)
i got wrong answer, but i don't know what test cases will produce wrong answer. I think my initialization is okay.


to admin : please delete my posts in volume CXI because I posted in wrong volume.

Posted: Sun Jul 15, 2007 11:12 am
by Rocky
i think u have some problem with taking input...
try with the following Input:

Code: Select all

4
.---b
.---bb
.--- --- -...  -.. --- -. .  ..--..  ..-. .. -. . -.-.--
.---
here b = blank space

have u got the correct output???

GOOD LUCK
Rocky

Posted: Sun Jul 15, 2007 11:30 am
by RC's
Thanks a lot. Got AC already.
You people are so great. Your test case is a tricky one.

Posted: Tue Jul 17, 2007 11:21 pm
by A1
sapnil wrote: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.
I think there is no input like these!!

read this line from problem statement:
code between two letters is a simple silence, the code between two words is a double silence.
so you don't need to count any starting and ending spaces.

and there is always maximum 2 spaces between two words. so you don't need to think about more then 2 spaces...
So No input like these:
.sss. or .ssss.

Posted: Thu Jul 26, 2007 6:23 am
by PG
I have tried all test case that everyone offered and passed all of them.

But I still got WA.

And I also tried this
3
.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ...- ..- ...- .-- -..- -.-- --..
.---- ..--- ...-- ....- ..... -.... --... ---.. ----. -----
.-.-.- .----. -.--. ---... .-.-. .-..-. -....- -.-.-- -.--.- -.-.-. -....- .--.-. ..--.. -..-. .-... -...- ..--.-
The ans is
Message #1
ABCDEFGHIJKLMNOPQRVUVWXYZ

Message #2
1234567890

Message #3
.'(:+"-!);-@?/&=_
This tese case include all charactors the problem give us.
So I think the table is OK.

Could anyone give me some advice?
Thanks in advanced.

There is my code.

Code: Select all

#include<iostream>
#include<string>
#include<sstream>
using namespace std;
char r(string q)
{ 
 // this function will return what q is.
}

int main()
{
    string q,t; int m; char c;
    cin>>m; cin.get();
    for(int i=1;i<=m;i++)
    {
        cout<<"Message #"<<i<<endl;
        while(cin>>q)
        {
            cout<<r(q);
            c=cin.get();
            if(c=='\n')break;
            if(cin.peek()==' '){cin.get();cout<<' ';}
        }
        cout<<endl;    
        if(i!=m)cout<<endl;
    }
}
There were a mistake in my input.
(Because I typed -....--.-.-- however it should be -....- -.-.--)
And I've fix it, still getting WA..

Posted: Thu Jul 26, 2007 11:48 am
by Robert Gerbicz
PG wrote:I have tried all test case that everyone offered and passed all of them.

But I still got WA.
I see only one error in your output, that's in:

Code: Select all

Message #3
.'(:+"-!);#?/&=_

Posted: Fri Jul 27, 2007 2:02 pm
by PG
There were a mistake in my input.
(Because I typed -....--.-.-- however it should be -....- -.-.--)
And I've fix it, still getting WA..

Posted: Tue Oct 23, 2007 2:42 pm
by Masud_CSE_SUST
Is There someone to help me?

Code: Select all

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

struct IND
{
	int r, c ;
} ;

char x[9][6][10] =
{
	{ ".-",   ".---", "...",   ".----", ".-.-.-", "---..." },
	{ "-...", "-.-",  "-",     "..---",  "--..--", "-.-.-." },
	{ "-.-.", ".-..", "..-",   "...--",  "..--..", "-...-"  },
	{ "-..",  "--",   "...-",  "....-",  ".----.", ".-.-."  },
	{ ".",    "-.",   ".--",   ".....",  "-.-.--", "-....-" },
	{ "..-.", "---",  "-..-",  "-....",  "-..-.",  "..--.-" },
	{ "--.",  ".--.", "-.--",  "--...",  "-.--.",  ".-..-." },
	{ "....", "--.-", "--..",  "---..",  "-.--.-", ".--.-." },
	{ "..",   ".-.",  "-----", "----.",  ".-..."			}
} ;

char L[9][10] =
{
	"AJS1.:", "BKT2,;", "CLU3?=", "DMV4\'+", "ENW5!-", "FOX6/_", "GPY7(\"", "HQZ8)@", "IR09&"
} ;

IND SER( char p[] )
{
	IND id ;
	int r, c ;

	for( r = 0; r < 9; r++ )
	{
		for( c = 0; c < 6; c++ )
		{
			if( !strcmp( x[r][c], p ) )
			{
				id.r = r ; id.c = c ; return id ;
			}
		}
	}
}

int main ()
{
	int T, i, l, kase ;
	char s[3000], letter[10] ;
	IND id ;

	//freopen( "11223.in", "r", stdin ) ;

	scanf( "%d", &T ) ;

	kase = 1 ;

	while( T-- )
	{
		scanf( " %[^\n]", s ) ;

		printf( "Message #%d\n", kase++ ) ;

		i = 0 ;

		while( 1 )
		{
			sscanf( &s[i], "%[^ \0]", letter ) ;

			l = strlen( letter ) ;

			id = SER( letter ) ;

			printf( "%c", L[id.r][id.c] ) ;

			if( s[i+l] == '\0' ) break ;

			if( s[i+l+1] == ' ' ) {  printf( " " ) ; i++ ; }

			i = i+l+1 ;
		}
		printf( "\n" ) ;

		if( T ) printf( "\n" ) ;
	}
	return 0 ;
}
I assume that no leading or trailing space and no more than 2 space between 2 characters

Posted: Tue Oct 23, 2007 7:10 pm
by Mushfiqur Rahman
Masud Wrote

I assume that no leading or trailing space and no more than 2 space between 2 characters
I also assumed like u and got ac.
I think u should recode this problem or should change the approach.
Sometimes it works better.

11223,WA ples help

Posted: Sat Feb 09, 2008 9:21 pm
by turcse143
this is sample input:
...s---s...
.---s---s-...ss-..s---s-.s.ss..--..ss..-.s..s-.s.s-.-.--
.-.s.-.ss.-.
ssss.ssss.
.sssssssss.
sssssssss.
ssss.ssss.sss
output:
Message #1
SOS

Message #2
JOB*DONE*?*FINE!

Message #3
RR*R

Message #4
**E**E

Message #5
E****E

Message #6
****E

Message #7
**E**E*

Press any key to continue

here:
s =space for input
* =space for output
i don't understand what my problem.
plese help!!!!! :cry:
give me some special input output.

Re: 11223 - O: dah dah dah! space problem

Posted: Fri Aug 15, 2008 6:22 am
by bishop
what about space i cannot understand
please give example through my code
and what wrong in my code

Code: Select all

#include<iostream>
#include<cstring>
#include<ctype.h>
using namespace std;
int main()
{
	string st[]={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..","-----",".----","..---","...--","....-",".....","-....","--...","---..","----.",".-.-.-","--..--","..--..",".----.","-.-.--","-..-.","-.--.","-.--.-",".-...","---...","-.-.-.","-...-",".-.-.","-....-","..--.-",".-..-.",".--.-."}; 
	string arr[]={"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",".",",","?","'","!","/","(",")","&",":",";","=","+","-","_","\"","@"};
	string m;
	string a;
	int t, in=1, i, j;
	char ch;
	bool f;	   
	cin >> t;
	cin.get();
	while(t--)
	{
		cout << "Message #"<<in++<<endl;
		a="";
		getline(cin,m);
		f=false;	
	
		for(i=0; i<=m.length(); i++)
		{
			if(m[i]==' '||i==m.length())
			{
							  	  
				for(j=0; j<53; j++)
				{
					if(a==st[j])
					{
						cout << arr[j];
						break;
					}	 
				}
			
			
				a="";
				if(m[i+1]==' ')
					cout << " ";
				
			}	
			else 
				{a+=m[i];}
		}
	
		cout << endl;	 
	}
	
	
	return 0;
}

Re: 11223 - O: dah dah dah!

Posted: Mon Oct 19, 2009 11:54 am
by george3456
check your '\n' line printing... :-?