HDU 1039 -Easier Done Than Said?
水水的
1 #include <iostream> 2 #include <cstring> 3 using namespace std; 4 char s[1000]; 5 bool flag; 6 int vol,v2,con; 7 int main() 8 { 9 while(cin>>s) 10 { 11 if(!strcmp(s,"end")) break; 12 flag=1; 13 v2=vol=con=0; 14 for(int i=0;s[i]!='\0';i++) 15 { 16 if(s[i]==s[i+1]&&(s[i]!='e'&&s[i]!='o')){ 17 flag=0; break; 18 } 19 if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') con=0,vol++,v2++; 20 else vol=0,con++; 21 if(vol==3||con==3){ 22 flag=0; break; 23 } 24 } 25 if(v2<1) flag=0; 26 if(flag) printf("<%s> is acceptable.\n",s); 27 else printf("<%s> is not acceptable.\n",s); 28 29 } 30 }
我自倾杯,君且随意