## 445 - Marvelous Mazes

Moderator: Board moderators

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 445 - Marvelous Mazes - Wrong answer

Input 10T output should be T
Check input and AC output for thousands of problems on uDebug!

walking_hell
New poster
Posts: 14
Joined: Tue Sep 24, 2013 4:35 pm

### uva 445

thanks for the previous solutions...i failed to catch my bug in this problem..so i need your help again..

Code: Select all

``````#include<stdio.h>
#include<string.h>
int rev(int x)
{
if(x<10)
return x;
int mod,sum=0;
while(x!=0)
{
sum=sum+x%10;
x=x/10;

}
return sum;

}

int main()
{
int numb,count,len,countund;
char arr[10000];
while(gets(arr))
{
len=strlen(arr);
for(count=0;count<len;count++)
{
if(arr[count]>='0' && arr[count]<='9')
{
sscanf(&arr[count],"%d",&numb);
numb=rev(numb);
label:

while(arr[count+1]>='0' && arr[count+1]<='9')
{
count=count+1;

}

}
else if(arr[count]=='!')
printf("\n");

else
{
if(arr[count]=='b')
arr[count]=' ';
for(countund=0;countund<numb;countund++)
printf("%c",arr[count]);

}

}

printf("\n");

}

return 0;
}
``````

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: uva 445

Input:

Code: Select all

``````1111111111111111111111111111111111111111X
``````
AC output:

Code: Select all

``````XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
``````
Check input and AC output for thousands of problems on uDebug!

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 445 - Marvelous Mazes - Wrong answer

I was getting WA (i found my bug at the end).