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 liuwencheng at 2010-11-07 11:09:40 on Problem 2895
这个简单题……都是被discuss给整的,让我wa了好多次,算法很多,比如笨办法,
while(s[i])
		{
			if(s[i]=='A'||s[i]=='B'||s[i]=='C')
			{
				t+=(s[i]-'A'+1)*t2;
				if(f==1)
					t+=t3;	
				f=1;
			}
			else if(s[i]=='D'||s[i]=='E'||s[i]=='F')
			{
				t+=(s[i]-'D'+1)*t2;
				if(f==2)
					t+=t3;
				f=2;
			}
			else if(s[i]=='G'||s[i]=='H'||s[i]=='I')
			{
				t+=(s[i]-'G'+1)*t2;
				if(f==3)
					t+=t3;
				f=3;
			}
			else if(s[i]=='J'||s[i]=='K'||s[i]=='L')
			{
				t+=(s[i]-'J'+1)*t2;
				if(f==4)
					t+=t3;
				f=4;
			}
			else if(s[i]=='M'||s[i]=='N'||s[i]=='O')
			{
				t+=(s[i]-'M'+1)*t2;
				if(f==5)
					t+=t3;	
				f=5;
			}
			else if(s[i]=='P'||s[i]=='Q'||s[i]=='R'||s[i]=='S')
			{
				t+=(s[i]-'P'+1)*t2;
				if(f==6)
					t+=t3;
				f=6;
			}
			else if(s[i]=='T'||s[i]=='U'||s[i]=='V')
			{
				t+=(s[i]-'T'+1)*t2;
				if(f==7)
					t+=t3;
				f=7;
			}
			else if(s[i]=='W'||s[i]=='X'||s[i]=='Y'||s[i]=='Z')
			{
				t+=(s[i]-'W'+1)*t2;
				if(f==8)
					t+=t3;
				f=8;
			}
			else if(s[i]==' ')
			{
				t+=t2;
				f=9;
			}
			i++;
好比较优的办法就是前辈们的打表发很不错

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