401 - Palindromes

All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: Palindromes 401 WA

Post by Jan »

Search the board first. Don't open a new thread if there is one already.
Ami ekhono shopno dekhi...
HomePage
samin
New poster
Posts: 6
Joined: Fri Jul 18, 2008 9:29 pm

Re: 401 palindromes WA help

Post by samin »

hello plz can any one help????????


Thanx vaiya
Last edited by samin on Fri Oct 24, 2008 9:23 pm, edited 1 time in total.
Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 401- Palindromes WA. I'm going crazy

Post by Obaida »

Code: Select all

Accepted after a lot wA....... 
:D :D :D
Last edited by Obaida on Tue Nov 04, 2008 8:12 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.
abid_iut
Learning poster
Posts: 82
Joined: Wed Jul 16, 2008 7:34 am

401 getting WA

Post by abid_iut »

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

int main()
{
char nor[25],rev[25];
int i,j=0,l,l1=0,l2=0,l3=0,l4=0;
//freopen("401.txt","r",stdin);
while(scanf("%s",nor)){
if(nor[0]=='\0')break;
l=strlen(nor);
l1=0;l2=0;l3=0;l4=0;
j=0;
for(i=l-1;i>=0;i--){
rev[j]=nor;
j++;
}
j=0;
for(i=0;i<l;i++){
if(nor==rev[j]){
l1=1;
j++;
}
else {l1=0;break;}
}

for(i=0;i<l;i++){
if(nor== 'A'||nor=='E'||nor=='3'||nor=='H'||nor=='I'||nor=='J'||nor=='L'||nor=='M'||nor[i]=='O'||nor[i]=='S'||nor[i]=='2'||nor[i]=='T'||nor[i]=='U'||nor[i]=='V'||nor[i]=='W'||nor[i]=='X'||nor[i]=='Y'||nor[i]=='5'||nor[i]=='Z'||nor[i]=='1'||nor[i]=='8' ){
l3=1;
}
else {l3=0;break;}
}

if(l1==0 && l3==0)printf("%s -- is not a palindrome.\n",nor);
else if(l1==1 && l3==0)printf("%s -- is a regular palindrome.\n",nor);
else if(l1==0 && l3==1)printf("%s -- is a mirrored string.\n",nor);
else printf("%s -- is a mirrored palindrome.\n",nor);
printf("\n");
for(i=0;i<l;i++)nor[i]='\0';
for(j=0;j<l;j++)rev[j]='\0';
}

return 0;
}


pls help!
i love to wait... wait for better... and better will come...
http://akanoi.webs.com/
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 401 getting WA

Post by sohel »

Search the board first. Don't create a new thread for a problem that already exists!
You can find in/out here.
lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 401 palindromes WA help

Post by lnr »

To samin.
Problem says:
In addition, after each output line, you must print an empty line.
May be you are not printing the blank line.
See the output format in this post above and in the problem.
Compare the format with yours.
Last edited by lnr on Fri Oct 17, 2008 8:45 pm, edited 1 time in total.
lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 401- Palindromes WA. I'm going crazy

Post by lnr »

To Obaida
Problem says:
In addition, after each output line, you must print an empty line.
May be you are not printing an extra blank line.
See the output format of this problem.
There are other threads for this problem.
See those also to be sure about the output format.
lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 401 palindromes WA help

Post by lnr »

To pushpit.saxena

Try these.
input:

Code: Select all

ISSEJML11JML322I
SV2OSV2
8SZSJYYL2528
output:

Code: Select all

ISSEJML11JML322I -- is a mirrored string.

SV2OSV2 -- is a mirrored string.

8SZSJYYL2528 -- is a mirrored string.
L I M O N
Learning poster
Posts: 58
Joined: Wed Dec 31, 2003 8:43 am
Location: Dhaka, Bangladesh
Contact:

Re: 401 palindromes WA help

Post by L I M O N »

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 401- Palindromes WA. I'm going crazy

Post by Obaida »

Thank you very much for the help. :)
But you know one thing i waited and waited for a help cause no one beside me to help. :(
You know it wass kidding with me. The number of wrong answer i got is too much.!!!!
try_try_try_try_&&&_try@try.com
This may be the address of success.
pok
New poster
Posts: 25
Joined: Sun Nov 09, 2008 11:04 pm

Re: 401- Palindromes WA. I'm going crazy

Post by pok »

why i got WA ??
pls help me..
i'll b crazy for this problem..

Code: Select all

removed after AC..
Last edited by pok on Sat Dec 13, 2008 10:56 pm, edited 1 time in total.
Articuno
Learning poster
Posts: 78
Joined: Sun Nov 30, 2008 5:00 pm
Location: IUT-OIC, Dhaka, Bangladesh

Re: 401- Palindromes WA. I'm going crazy

Post by Articuno »

Your output is not correct for this test case:

Code: Select all

AAAAAGAAAAA
it is a regular palindrome, not a mirrored one.
May be tomorrow is a better day............ :)
pok
New poster
Posts: 25
Joined: Sun Nov 09, 2008 11:04 pm

Re: 401- Palindromes WA. I'm going crazy

Post by pok »

after editing i submitted my code..
but i got WA again..
i cant understand why i got WA this time..
pls help me..

Code: Select all

removed after AC..
pls help me..
Last edited by pok on Sat Dec 13, 2008 10:56 pm, edited 1 time in total.
Articuno
Learning poster
Posts: 78
Joined: Sun Nov 30, 2008 5:00 pm
Location: IUT-OIC, Dhaka, Bangladesh

Re: 401- Palindromes WA. I'm going crazy

Post by Articuno »

You did not consider the case when a character of input string is not found in your array b. You do not use any flag to determine that. That's why your program is giving wrong answer for these cases:

Code: Select all

Ebb3
BBABB
the output should be:

Code: Select all

Ebb3 -- is not a palindrome.

BBABB -- is a regular palindrome.

And you should not consider '[' or ']' as it is not in the problem description.
Wish you good luck :)
[I have changed your code a little and now it is AC.]
May be tomorrow is a better day............ :)
pok
New poster
Posts: 25
Joined: Sun Nov 09, 2008 11:04 pm

Re: 401- Palindromes WA. I'm going crazy

Post by pok »

Thanks a lot Articuno ..
now my code is AC..
GOD bless u..
take care..
Post Reply

Return to “Volume 4 (400-499)”