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

Post by hamedv » Fri Jun 22, 2007 6:38 pm

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

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

Post by spir » Wed Jun 27, 2007 1:27 pm

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

User avatar
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am
Contact:

Post by Rocky » Sat Jul 07, 2007 9:48 pm

to spir:

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

GOOD LUCK
Rocky

RC's
Learning poster
Posts: 65
Joined: Fri Jul 13, 2007 3:17 pm

Post by RC's » Sat Jul 14, 2007 7:42 am

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.
Last edited by RC's on Sun Jul 15, 2007 11:28 am, edited 1 time in total.

User avatar
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am
Contact:

Post by Rocky » Sun Jul 15, 2007 11:12 am

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

RC's
Learning poster
Posts: 65
Joined: Fri Jul 13, 2007 3:17 pm

Post by RC's » Sun Jul 15, 2007 11:30 am

Thanks a lot. Got AC already.
You people are so great. Your test case is a tricky one.

User avatar
A1
Experienced poster
Posts: 173
Joined: Wed Jan 28, 2004 3:34 pm
Location: Bangladesh

Post by A1 » Tue Jul 17, 2007 11:21 pm

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.

PG
New poster
Posts: 4
Joined: Mon Nov 14, 2005 7:16 am

Post by PG » Thu Jul 26, 2007 6:23 am

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..
Last edited by PG on Thu Jul 26, 2007 5:01 pm, edited 1 time in total.

Robert Gerbicz
Experienced poster
Posts: 196
Joined: Wed May 02, 2007 10:12 pm
Location: Hungary, Pest county, Halasztelek
Contact:

Post by Robert Gerbicz » Thu Jul 26, 2007 11:48 am

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
.'(:+"-!);#?/&=_

PG
New poster
Posts: 4
Joined: Mon Nov 14, 2005 7:16 am

Post by PG » Fri Jul 27, 2007 2:02 pm

There were a mistake in my input.
(Because I typed -....--.-.-- however it should be -....- -.-.--)
And I've fix it, still getting WA..

User avatar
Masud_CSE_SUST
New poster
Posts: 11
Joined: Sat Jul 22, 2006 8:45 pm
Location: Sylhet, Bagladesh
Contact:

Post by Masud_CSE_SUST » Tue Oct 23, 2007 2:42 pm

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
"Computer science is no more about computers than astronomy is about telescopes." - Dijkstra

Mushfiqur Rahman
Learning poster
Posts: 56
Joined: Tue Jun 13, 2006 5:18 pm
Location: (CSE, SUST) Sylhet, Bangladesh
Contact:

Post by Mushfiqur Rahman » Tue Oct 23, 2007 7:10 pm

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.

turcse143
Learning poster
Posts: 81
Joined: Wed May 09, 2007 9:59 pm
Location: (CSE,DU) Dhaka,Bangladesh

11223,WA ples help

Post by turcse143 » Sat Feb 09, 2008 9:21 pm

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.
''I want to be most laziest person in the world''

bishop
New poster
Posts: 43
Joined: Fri May 04, 2007 12:57 pm

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

Post by bishop » Fri Aug 15, 2008 6:22 am

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

george3456
New poster
Posts: 5
Joined: Tue Sep 15, 2009 11:16 am

Re: 11223 - O: dah dah dah!

Post by george3456 » Mon Oct 19, 2009 11:54 am

check your '\n' line printing... :-?
The most important thing is never stop questioning ~ Albert Einstein

Post Reply

Return to “Volume 112 (11200-11299)”