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:请指出为啥错了 我想死的心都有了

Posted by Irush_ at 2013-07-15 16:03:02 on Problem 1575
In Reply To:请指出为啥错了 我想死的心都有了 Posted by:sfwtoms1 at 2012-09-13 21:04:52
> /*字符串处理*/
> #include<stdio.h>
> #include<string.h>
> int  vowel(char *p)
> {
> 	if(*p=='a'||*p=='e'||*p=='i'||*p=='o'||*p=='u')
> 		return 1;
> 	else  return 0;
> }
> int main()
> {
> int i;
> char test[1000];
> int n_v;
> int flags,cnt,l;
> while(scanf("%s",test))
> {   
> 	flags=cnt=0;
> 	if(!strcmp(test,"end"))return 0;
> 	l=strlen(test);
>     for(i=0;i<l;i++)
> 	{
> 	if(i+2<=l&&vowel(test+i)&&vowel(test+i+1)&&vowel(test+i+2))
> 	{
> 		printf("<%s> is not acceptable.\n",test);
> 		flags=1;
> 		break;
> 	}
> 	if(i+2<=l&&vowel(test+i)==0&&vowel(test+i+1)==0&&vowel(test+i+2)==0)
> 	{
> 		printf("<%s> is not acceptable.\n",test);
> 		flags=1;
> 		break;
> 	}
>    if(i+1<=l&&*(test+i)==*(test+i+1)&&*(test+i)!='e'&&*(test+i)!='o')
> 	{
>     printf("<%s> is not acceptable.\n",test);
> 	flags=1;
> 	break;
>     }
>      if(vowel(test+i)) cnt++;
> 	}
> 	if(flags==0&&cnt>0) printf("<%s> is acceptable.\n",test);
> 	else if(flags==0&&cnt==0)
> 		printf("<%s> is not acceptable.\n",test);
> }
> }

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