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

我在我的电脑上运行时正确的,为什么在online上得到的是“wrong answer”?

Posted by feima at 2008-10-15 11:43:44 on Problem 3096
如下是我的源程序:
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string str;
	cin>>str;
	int i, j, k,tag = 0;
	string::size_type dist;
	while(str!="*")
	{
          for(  dist = 0; dist <= str.size(); dist++)
		  {
			   k = str.size() - dist - 1;
			  string substr[1000];
			  for( i = 0; i < k; i++)
			  {
				  substr[i] = substr[i] + str[i];
				  substr[i] = substr[i] + str[i + dist + 1];
			  }
			  for(i = 0; i < k-1; i++)
				  for(j = i + 1 ; j < k; j++)
					  if(substr[i] == substr[j] )
					  {   
						  tag = 1;
						  cout<<str<<" is NOT surprising."<<endl;
						  break;
					  }
			 if(tag == 1)
						  break;
		  }
		  if(dist > str.size())
				   cout<<str<<" is surprising."<<endl;
			cin>>str;
		
	}
	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