| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
1A,太水了,适合睡前刷#include <iostream>
#include <cstring>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;
bool isVowel(char c){
return c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y';
}
void parse(string &s, string &s1, string &s2, string &s3){
int st = 0;
while(s[st]!='/'){
s1+=s[st];
st++;
}
st++;
while(s[st]!='/'){
s2+=s[st];
st++;
}
st++;
int l = s.length();
while(st<l){
s3+=s[st];
st++;
}
}
int slbCnt(string &s){
int res = 0;
bool inV = 0;
int l=s.length();
for(int i = 0; i < l; i++){
if(!inV){
if(isVowel(s[i])){
inV=1;
res++;
}
}
if(inV){
if(!isVowel(s[i])){
inV=0;
}
}
}
return res;
}
int main() {
string s;
while(1){
getline(cin ,s);
if(strcmp(s.c_str(), "e/o/i")==0) break;
string s1, s2, s3;
parse(s, s1, s2, s3);
int res;
if(slbCnt(s1)!=5){
res=1;
}
else if(slbCnt(s2)!=7){
res=2;
}
else if(slbCnt(s3)!=5){
res=3;
}
else res=0;
res? printf("%d\n",res): printf("Y\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator