
445 - Marvelous Mazes
Moderator: Board moderators
-
- New poster
- Posts: 2
- Joined: Sat Jul 10, 2004 3:50 pm
-
- New poster
- Posts: 14
- Joined: Mon Sep 03, 2007 10:11 am
- Contact:
445 wa and AC
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
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
-
- New poster
- Posts: 38
- Joined: Tue Jul 17, 2007 3:21 pm
- Location: East West University
AC
Last edited by Fuad Hassan EWU on Sun Nov 25, 2007 9:02 pm, edited 1 time in total.
Eagle er moto daana meley urbo
To Fuad Hassan EWU
your output is like this:
but it must be
'<' indecate cursor.
Hope its help
Thanks
Keep posting
Sapnil
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<
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
<
Hope its help
Thanks
Keep posting
Sapnil
"Dream Is The Key To Success"
@@@ Jony @@@
@@@ Jony @@@
-
- New poster
- Posts: 38
- Joined: Tue Jul 17, 2007 3:21 pm
- Location: East West University
445 - Marvelous Mazes #WA! Please help me.
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;
}
Mahedee
Re: 445 - Marvelous Mazes #WA! Please help me.
Do not create a new thread for a problem if one already exists!
-
- New poster
- Posts: 24
- Joined: Fri Oct 24, 2008 8:37 pm
- Location: CUET, Chittagong, Bangladesh
- Contact:
445 - Marvelous Mazes
AC - Thanks
Last edited by aliahmed on Wed Jan 14, 2009 8:23 pm, edited 1 time in total.
Re: 445 WA
why I am getting WA
pls someone check
here is my code:
pls help 
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;
}

i love to wait... wait for better... and better will come...
http://akanoi.webs.com/
http://akanoi.webs.com/
-
- Learning poster
- Posts: 78
- Joined: Sun Nov 30, 2008 5:00 pm
- Location: IUT-OIC, Dhaka, Bangladesh
Re: 445 WA
What are you trying to do with this? :
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:Your code fails.The output should be
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:
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.
Code: Select all
if(str[0]=='\n')
printf("\n");
And for this case:
Code: Select all
101a
Code: Select all
aa
There is one more thing. Think about this case:
Code: Select all
1a<There may be a '\n'>
Wish you good luck.

May be tomorrow is a better day............ 

Re: 445 WA
Thanks Articuno
U r a great guide for me
Thanks for help
U r a great guide for me
Thanks for help

i love to wait... wait for better... and better will come...
http://akanoi.webs.com/
http://akanoi.webs.com/
Re: 445 - Marvelous Mazes
Try these inputs
input:
output:
input:
Code: Select all
1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T!
11X21b1X!
4X1b1X!
3X3b3X1b1X5b1X1b1X2b1X3b1X2b1X1b4X1b4X1b1X3b3X
1b1X4b1X1b1X1b1X2b1X2b1X1b2X1b1X3b2X1b1X1b1X2b1X1b1X2b1X1b3X2b1X
1b1X4b3X2b1X1b1X1b1X2b1X1b2X3b1X1b2X1b1X2b1X1b1X2b1X1b1X1b1X3b1X
3X3b1X5b1X1b1X3b1X2b1X3b1X2b1X1b4X1b4X1b3X1b3X
3O3b3O1b1O5b1O1b1O2b1O3b1O2b1O1b4O1b4O1b1O3b3O
1b1O4b1O1b1O1b1O2b1O2b1O1b2O1b1O3b2O1b1O1b1O2b1O1b1O2b1O1b3O2b1O
1b1O4b3O2b1O1b1O1b1O2b1O1b2O3b1O1b2O1b1O2b1O1b1O2b1O1b1O1b1O3b1O
3O3b1O5b1O1b1O3b1O2b1O3b1O2b1O1b4O1b4O1b3O1b3O
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
Solving for fun..
-
- New poster
- Posts: 24
- Joined: Fri Oct 24, 2008 8:37 pm
- Location: CUET, Chittagong, Bangladesh
- Contact:
Re: 445 - Marvelous Mazes
I test your input
I think my output is correct
then why wa again?
I think my output is correct
then why wa again?
Re: 445 - Marvelous Mazes
Code: Select all
if(str[i]=='\0')
break;
if(str[i]>=48 && str[i]<=56)
{
sum=sum+str[i]-48;
continue;
}
Solving for fun..
help help help.445
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;
}


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.
Code: Select all
#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;
}