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 kric at 2007-04-07 21:41:31 on Problem 3096
#include<iostream>
using namespace std;
int main()
{
	char p[80],xx[40][2];
	int i,j,len,t,k,s;
	while(1)
	{
		gets(p);
		if(p[0]=='*')
			break;
		len=strlen(p);
		for(i=1;i<len;i++)
		{
			t=1;
			k=0;
			for(j=0;j+i<len;j++)
			{
				xx[k][0]=p[j];
				xx[k][1]=p[j+i];
				k++;
			}
			
			for(j=0;j<k-1;j++)
			{
				for(s=j+1;s<k;s++)
				{
					if(xx[j][0]==xx[s][0]&&xx[j][1]==xx[s][1])
					{
						t=0;
						break;
					}
				}
				if(!t)
					break;
			}
			if(!t)
				break;
		}
		if(t)
			printf("%s is surprising.\n",p);
		else
			printf("%s is NOT surprising.\n",p);
	}
	return 1;
}

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