401- Palindromes

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

Moderator: Board moderators

Re: Palindromes 401 WA

Postby Jan » Mon Jul 14, 2008 10:53 pm

Search the board first. Don't open a new thread if there is one already.
Ami ekhono shopno dekhi...
HomePage
Jan
Guru
 
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh

Re: 401 palindromes WA help

Postby samin » Fri Jul 18, 2008 9:57 pm

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.
samin
New poster
 
Posts: 5
Joined: Fri Jul 18, 2008 9:29 pm

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

Postby Obaida » Tue Jul 29, 2008 10:09 am

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.
Obaida
A great helper
 
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

401 getting WA

Postby abid_iut » Sun Aug 31, 2008 6:27 am

#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[i];
j++;
}
j=0;
for(i=0;i<l;i++){
if(nor[i]==rev[j]){
l1=1;
j++;
}
else {l1=0;break;}
}

for(i=0;i<l;i++){
if(nor[i]== 'A'||nor[i]=='E'||nor[i]=='3'||nor[i]=='H'||nor[i]=='I'||nor[i]=='J'||nor[i]=='L'||nor[i]=='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/
abid_iut
Learning poster
 
Posts: 80
Joined: Wed Jul 16, 2008 7:34 am

Re: 401 getting WA

Postby sohel » Sun Aug 31, 2008 7:58 am

Search the board first. Don't create a new thread for a problem that already exists!
You can find in/out here.
User avatar
sohel
Guru
 
Posts: 859
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 401 palindromes WA help

Postby lnr » Fri Oct 17, 2008 7:39 pm

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.
User avatar
lnr
Experienced poster
 
Posts: 137
Joined: Sat Jun 30, 2007 2:52 pm
Location: (DU,CSE)Dhaka,Bangladesh

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

Postby lnr » Fri Oct 17, 2008 7:48 pm

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.
User avatar
lnr
Experienced poster
 
Posts: 137
Joined: Sat Jun 30, 2007 2:52 pm
Location: (DU,CSE)Dhaka,Bangladesh

Re: 401 palindromes WA help

Postby lnr » Fri Oct 17, 2008 8:01 pm

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.
User avatar
lnr
Experienced poster
 
Posts: 137
Joined: Sat Jun 30, 2007 2:52 pm
Location: (DU,CSE)Dhaka,Bangladesh

Re: 401 palindromes WA help

Postby L I M O N » Sat Nov 01, 2008 6:55 pm

L I M O N
Learning poster
 
Posts: 58
Joined: Wed Dec 31, 2003 8:43 am
Location: Dhaka, Bangladesh

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

Postby Obaida » Tue Nov 04, 2008 8:09 am

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.
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

Postby pok » Thu Dec 11, 2008 9:39 pm

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.
pok
New poster
 
Posts: 25
Joined: Sun Nov 09, 2008 11:04 pm

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

Postby Articuno » Fri Dec 12, 2008 2:21 pm

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............ :)
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

Postby pok » Fri Dec 12, 2008 9:50 pm

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.
pok
New poster
 
Posts: 25
Joined: Sun Nov 09, 2008 11:04 pm

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

Postby Articuno » Sat Dec 13, 2008 7:50 am

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............ :)
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

Postby pok » Sat Dec 13, 2008 10:53 pm

Thanks a lot Articuno ..
now my code is AC..
GOD bless u..
take care..
pok
New poster
 
Posts: 25
Joined: Sun Nov 09, 2008 11:04 pm

PreviousNext

Return to Volume IV

Who is online

Users browsing this forum: No registered users and 2 guests