UCF Local Programming Contest 2014

A

读写一个字符串用2个变量记录元音和辅音的数量即可

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 0x3f3f3f3f;
const ll maxn= 1e5+10;
int main(){
	int n;
	cin>>n;
	while(n--){
		string str;
		cin>>str;
		int cunt=0;
		int flag=0;
		for(int i=0;i<str.length();i++){
			if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'){
				cunt++;
			}else{
				flag++;
			}
		}
		cout<<str<<"\n";
		if(cunt>flag){
			cout<<"1"<<"\n";
		}else{
			cout<<"0"<<"\n";
		}
	} 


	return 0;
}

你可能感兴趣的:(训练题)