Page 5 of 7

Posted: Tue Jun 26, 2007 2:01 pm
by Stanley Sentoso
oh, i miss something. i change my variabel data type from char to unsigned char, but i still got Presentation Error (PE). :(

445 wa and AC

Posted: Wed Sep 12, 2007 8:02 pm
by rossi kamal
sorry i ve found that silly mistake.....but i want to mention that

my ac code gives the following result
make it clear plz..

input:
1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T!

11X21b1X!
4X1b1X!


outout:
T TTTTT
T T TT
T T TT
T T T
TTT T
T T T
TTTTT*T


XX X

XXXX X

Posted: Sun Nov 18, 2007 6:14 pm
by Fuad Hassan EWU
AC

Posted: Fri Nov 23, 2007 3:03 pm
by sapnil
To Fuad Hassan EWU

your output is like this:

Code: Select all

T TTTTT
T  T TT
T T  TT
T   T T
TTT   T
T   T T
TTTTT*T
 
XX   X
XXXX X<
but it must be

Code: Select all

T TTTTT
T  T TT
T T  TT
T   T T
TTT   T
T   T T
TTTTT*T
 
XX   X
XXXX X
<
'<' indecate cursor.

Hope its help

Thanks
Keep posting
Sapnil

thanks

Posted: Sun Nov 25, 2007 9:01 pm
by Fuad Hassan EWU
8) yes sapnil. it works. thanks... :wink:

445 - Marvelous Mazes #WA! Please help me.

Posted: Tue Jul 15, 2008 2:46 am
by mahedee
I tried this problem for several time but still getting WA. Could you please help me?

Code: Select all

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

int main()
{
	char str[500];
	int i,j,val=0;
	int len,flag =0;
	while(gets(str)!=NULL)
	{
		//printf("\n");
		len = strlen(str);
		if(len==0)
		{
			printf("\n");
			continue;
		}
		for(i = 0;i<len;i++)
		{
			if(str[i]>=48&&str[i]<=57)
			{
				val = val + (str[i]-48);
			}

			else
			{
				j = 0;
				do
				{
					if(str[i]=='b')
						printf(" ");
					else if(str[i] == '!'||str[i] == '\n')
						printf("\n");
					else
						printf("%c",str[i]);
					
					j++;
				}while(j<val);
				val = 0;
			}
		}
		printf("\n\n");		

	}
	return 0;
}

Re: 445 - Marvelous Mazes #WA! Please help me.

Posted: Tue Jul 15, 2008 8:52 am
by sohel
Do not create a new thread for a problem if one already exists!

445 - Marvelous Mazes

Posted: Fri Nov 14, 2008 10:53 pm
by aliahmed
AC - Thanks

Re: 445 WA

Posted: Mon Dec 15, 2008 1:15 pm
by abid_iut
why I am getting WA
pls someone check
here is my code:

Code: Select all

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

int main()
{
	char str[200];
	int i,j,n,flag=0;
	while(gets(str)!=NULL){
		if(flag==0)flag=1;
		else putchar('\n');
		if(str[0]=='\n')
			printf("\n");
		else {
			n=0;
			for(i=0;str[i]!=0;i++)
				if(str[i]=='!')
					putchar('\n');
				else 
					if(str[i]>='1' && str[i]<='9')
						n+=str[i]-48;
					else {
						for(j=0;j<n;j++){
							if(str[i]=='b')printf(" ");
							else
							printf("%c",str[i]);
						}
						n=0;
					}
			}
		
	}
	return 0;
}
pls help :(

Re: 445 WA

Posted: Mon Dec 15, 2008 7:10 pm
by Articuno
What are you trying to do with this? :

Code: Select all

if(str[0]=='\n')
         printf("\n");
You are using gets() and I think it is not possible for a string to have a '\n' character while you are using gets().
And for this case:

Code: Select all

101a
Your code fails.The output should be

Code: Select all

aa
I think this problem requires to read input character by character. Then you will be able to check for '\n' character.
There is one more thing. Think about this case:

Code: Select all

1a<There may be a '\n'>

if it is the last test case and there is a newline after "1a" your program will fail to print that newline. Do you get my point?
Wish you good luck. :-?

Re: 445 WA

Posted: Mon Dec 15, 2008 8:44 pm
by abid_iut
Thanks Articuno
U r a great guide for me
Thanks for help :)

Re: 445 - Marvelous Mazes

Posted: Thu Dec 25, 2008 2:10 am
by linux
Try these inputs

input:

Code: Select all

    1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T!

    11X21b1X!
    4X1b1X!

    3X3b3X1b1X5b1X1b1X2b1X3b1X2b1X1b4X1b4X1b1X3b3X
    1b1X4b1X1b1X1b1X2b1X2b1X1b2X1b1X3b2X1b1X1b1X2b1X1b1X2b1X1b3X2b1X
    1b1X4b3X2b1X1b1X1b1X2b1X1b2X3b1X1b2X1b1X2b1X1b1X2b1X1b1X1b1X3b1X
    3X3b1X5b1X1b1X3b1X2b1X3b1X2b1X1b4X1b4X1b3X1b3X


    3O3b3O1b1O5b1O1b1O2b1O3b1O2b1O1b4O1b4O1b1O3b3O
    1b1O4b1O1b1O1b1O2b1O2b1O1b2O1b1O3b2O1b1O1b1O2b1O1b1O2b1O1b3O2b1O
    1b1O4b3O2b1O1b1O1b1O2b1O1b2O3b1O1b2O1b1O2b1O1b1O2b1O1b1O1b1O3b1O
    3O3b1O5b1O1b1O3b1O2b1O3b1O2b1O1b4O1b4O1b3O1b3O
output:

Code: Select all

    T TTTTT
    T  T TT
    T T  TT
    T   T T
    TTT   T
    T   T T
    TTTTT*T


    XX   X

    XXXX X


    XXX   XXX X     X X  X   X  X XXXX XXXX X   XXX
    X    X X X  X  X XX X   XX X X  X X  X XXX  X
    X    XXX  X X X  X XX   X XX X  X X  X X X   X
    XXX   X     X X   X  X   X  X XXXX XXXX XXX XXX


    OOO   OOO O     O O  O   O  O OOOO OOOO O   OOO
    O    O O O  O  O OO O   OO O O  O O  O OOO  O
    O    OOO  O O O  O OO   O OO O  O O  O O O   O
    OOO   O     O O   O  O   O  O OOOO OOOO OOO OOO

Re: 445 - Marvelous Mazes

Posted: Fri Jan 09, 2009 10:00 pm
by aliahmed
I test your input
I think my output is correct
then why wa again?

Re: 445 - Marvelous Mazes

Posted: Mon Jan 12, 2009 6:25 pm
by linux

Code: Select all

if(str[i]=='\0')
break;
if(str[i]>=48 && str[i]<=56)
{
sum=sum+str[i]-48;
continue;
}
What about the digit 9? Why are ignoring it? It's not any less important to get AC. Other parts of the code seems okay.

help help help.445

Posted: Sat Feb 07, 2009 9:58 pm
by shorojini
i am getting wrong answer in this problem. :( :(
i am giving my code here.if there is not any prob in code then there must
be some prob in my input output system.please can anyone give me any solution and
some some sample input output.pls pls pls mark me my prob.pls pls pls. #include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
while(getline(cin,s))
{
int l=s.length();

int k=0;
for(int i=0;i<l;i++){

if(s>=48 && s<=57)
k=k+s-48;

else if(s=='!')
cout<<"\n";

else{
if(s=='b') {
for(int i=0;i<k;i++)
cout<<" "; }
else{
for(int j=0;j<k;j++)
cout<<s; }
k=0;
}

if(i==l-1)
cout<<"\n";

}




}
return 0;
}