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

这……这……这是为么子啊??哪错了啊~~~做出来的大牛们看看~~貌似很多人都是这种情况呢~~~附代码~~跪谢了……

Posted by choupigwb at 2008-06-11 22:44:02 on Problem 2608 and last updated at 2008-06-11 22:45:23
#include <iostream>
using namespace std;
int  main()
{
	char str1[21],str2[21];
	while(cin>>str1)
	{
		int top=-1,tag=0,len=strlen(str1);
		for(int i=0;i<len;i++)
		{			
			if(str1[i]=='R')
				str2[++top]='6';
			else if(str1[i]=='L')
				str2[++top]='4';
			else if(str1[i]=='D'||str1[i]=='T')
				str2[++top]='3';
			else if(str1[i]=='M'||str1[i]=='N')
				str2[++top]='5';
			else if(str1[i]=='B'||str1[i]=='F'||str1[i]=='P'||str1[i]=='V')
				str2[++top]='1';
			else if(str1[i]=='C'||str1[i]=='G'||str1[i]=='J'||str1[i]=='K'||str1[i]=='Q'||str1[i]=='X'||str1[i]=='S'||str1[i]=='Z')
				str2[++top]='2';
			else
			{
				tag=1;
			}
			if(top>0&&str2[top]==str2[top-1])
			{
				if(!tag)
					top--;
				else
					tag=0;
			}
		}
		str2[++top]='\0';
		cout<<str2<<endl;
	}
	return 1;
}

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