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

Re:例子:abcba——》aabcb 错

Posted by lsh at 2007-03-03 10:17:31 on Problem 1146
In Reply To:Why WA?Who can help me?Thanks. Posted by:nb at 2005-05-05 18:57:11
> //FileName : 146.cpp
> 
> //Author   : Wang Bo
> 
> 
> 
> 
> #include <iostream.h>
> 
> #include <string.h>
> 
> 
> 
> int main()
> 
> {
> 
> 	char line[55];
> 
> 	short i,j,len;
> 
> 
> 
> 	while(1)
> 
> 	{
> 
> 		cin>>line;
> 
> 		if(line[0]=='#')
> 
> 			break;
> 
> 		len=strlen(line);
> 
> 		for(i=len-1;i && line[i-1]>=line[i];i--)
> 
> 			;
> 
> 		if(i==0)
> 
> 		{
> 
> 			cout<<"No Successor"<<endl;
> 
> 			continue;
> 
> 		}
> 
> 		for(j=0;j<i-1;j++)
> 
> 			cout<<line[j];
> 
> 		cout<<line[len-1];
> 
> 		for(j=i-1;j<len-1;j++)
> 
> 			cout<<line[j];
> 
> 		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