A - New Year and Counting Cards

题说的是如果一堆卡片 每个卡片两面分别写着字母和数字;
检查 "元音字母’a’, ‘e’, ‘i’, ‘o’ , 'u’后面一定是偶数"这个命题成不成立
我们可以翻卡片来检查 问最少需要翻多少次
就是说只有以下三种对应关系
元音字母-偶数
辅音字母-偶数
辅音字母-奇数
而我们只能看见一面 所以需要检验
我们能看见一下四类
1.元音字母:需要翻-----------
2.辅音字母-不需要翻
3.奇数-需要翻-----------------
4.偶数-不需要翻

这样就很简单了
AC代码如下:


/****************************
 *
 * Name   :1
 * Time   :2019-1-19 21:27:03
 * Author :大哥
 * Type   :签到
 * 版权所有_翻版不管
 *
 ****************************
 */

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>

using namespace std;
//ios::sync_with_stdio(false);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const double PI = acos(-1.0);
const double eps = 1e-6;
const ll mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;
const int maxm = 100+10;
#define N 10000
#define M 100


int main(){

#ifdef LOCAL
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
#endif
	string s;
	cin>>s;
	int ans = 0;
	for (char i : s){
		if (i=='1'||i=='3'||i=='5'||
			i=='7'||i=='9'||
			i=='a'||i=='e'||i=='i'||
			i=='o'||i=='u'){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_42580946/article/details/86588778