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:那位大哥哥,大姐姐 能帮我看看为什么WRONG ANSWER

Posted by 913106840245 at 2014-07-27 22:31:59 on Problem 1146
In Reply To:那位大哥哥,大姐姐 能帮我看看为什么WRONG ANSWER Posted by:ban at 2006-07-05 16:29:03
咋两想一块去了   一样WA

#include <iostream>
#include <cstring>
using namespace std;
char a[1000];
char temp;
int i,n,j;
int main ()
{
	while(cin>>a&&a[0]!='#')
	{
		n=strlen(a)-1;
		temp=a[n];
		for(i=n-1;a[n]<=a[i]&&i>0;i--)
			;
		if(i==0)
			cout<<"No Successor";
		else	
		{
			for(j=n-1;j>=i;j--)
				a[j+1]=a[j];
			a[i]=temp;
			for(i=0;i<=n;i++)
				cout<<a[i];
		}
		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