Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

要考虑某个字母没有逆的情况,这个时候mirro是不存在的。我也在这个地方WA了好几次,后来仔细读题才发现的。

Posted by yygy at 2013-02-28 08:50:47 on Problem 1590
In Reply To:WA 的我心都碎了。。。大侠帮帮忙 Posted by:twotwotwo at 2013-02-27 22:24:05
> #include<iostream>
> #include<string.h>
> #include<stdio.h>
> using namespace std;
> int main()
> {
> 	char str[100];
> 	string s1="AEHIJLMOSTUVWXYZ12358";
> 	string s2="A3HILJMO2TUVWXY51SEZ8";
> 	while(scanf("%s",str)!='EOF')
> 	{
> 		int len=strlen(str);
> 	int i,j;
> 	for(i=0;str[i]==str[len-i-1]&&i<len;i++);
> 	bool palin=false;
> 	bool mirror=true;
> 	if(i==len)
> 		palin=true;
> 	for(i=0;i<len;i++)
> 	{
> 		for(j=0;j<21;j++)
> 		{
> 			if(str[i]==s1[j])
> 				if(s2[j]==str[len-i-1])
> 					break;
> 		}
> 		if(j==21)
> 		{
> 			mirror=false;
> 			break;
> 		}
> 	}
> 	cout<<str;
> 	if(palin)
> 	{
> 		if(mirror)
> 			cout<<" -- is a mirrored palindrome."<<endl;
> 		else
> 			cout<<" -- is a regular palindrome."<<endl;
> 	}
> 	else
> 	{
> 		if(mirror)
> 			cout<<" -- is a mirrored string."<<endl;
> 		else
> 			cout<<" -- is not a palindrome."<<endl;
> 	}
> 	cout<<endl;
> 	}
> 	return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator