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

请教高手。。。W在哪。。。

Posted by zhou6978490 at 2009-08-03 14:11:57 on Problem 1575
#include<iostream>
using namespace std;
int dif(char a[1000])
{
	if(a[0]=='e'&&a[1]=='n'&&a[2]=='d'&&a[3]=='\0')
		return 0;
}

int main()
{
	char a[1000];
	while(gets(a)&&dif(a))
	{
		int i,x(0),j(0),k(0);
		int m[5000],n[5000];
		m[0]=1,n[0]=1;
		for(i=0,x;i<=strlen(a);i++)
		{
			if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')
			{x++;
			m[i+1]=m[i]+1;
			n[i+1]=n[i];
			}
			else
			{
				m[i+1]=m[i];
				n[i+1]=n[i]+1;
			}
			if(a[i]==a[i+1]&&a[i]!='e'&&a[i]!='o')
				j++;
			if(m[i]-m[i-3]==3||n[i]-n[i-3]==3)
				k++;
		}
		if(x!=0&&j==0&&k==0)
			cout<<"<"<<a<<"> is acceptable."<<endl;
		else
			cout<<"<"<<a<<"> is not acceptable."<<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