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

WA 的我心都碎了。。。大侠帮帮忙

Posted by twotwotwo at 2013-02-27 22:24:05 on Problem 1590
#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