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

谁帮我看看 running error 怎么处理

Posted by chjwdzhr at 2010-05-28 18:56:34 on Problem 3080
#include <iostream>
#include <string>
using namespace std;
string input[10];
string tem[60],tem2[60];
int sum;
int findc(int a,int b)
{
	string aa=input[0].substr(a,b);
	for(int i=1;i<sum;i++)
		if(input[i].find(aa)==-1)
			return b-1;
	if(a+b==59)
		return b;
	return findc(a,b+1);
}
int main()
{
	int a,i,k,n,num,s;
	cin>>n;
	while(n--)
	{
		cin>>num;
		for(i=0;i<num;i++)
			cin>>input[i];
		sum=num;
		i=0;
		a=0;
		while(a<=57)
		{
			int d=findc(a,3);
			if(d==2)
				a++;
			else
			{
				tem[i]=input[0].substr(a,d);
				i++;
				a=a+d;
			}

		}
		s=0;
		if(i==0)
			cout<<"no significant commonalities"<<endl;
		else
		{
			for(k=0;k<i;k++)
			{
				if(s<tem[k].size())
					s=k;
			}
			cout<<tem[s]<<endl;
		}
		

	}
	
	return 0;
}
			



在我机器上运行好使 ,上去就runningerror





	

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