codeforces 908A New Year and Counting Cards

(http://www.elijahqi.win/2017/12/30/codeforces-908a-new-year-and-counting-cards/)
Your friend has n cards.

You know that each card has a lowercase English letter on one side and a digit on the other.

Currently, your friend has laid out the cards on a table so only one side of each card is visible.

You would like to know if the following statement is true for cards that your friend owns: “If a card has a vowel on one side, then it has an even digit on the other side.” More specifically, a vowel is one of ‘a’, ‘e’, ‘i’, ‘o’ or ‘u’, and even digit is one of ‘0’, ‘2’, ‘4’, ‘6’ or ‘8’.

For example, if a card has ‘a’ on one side, and ‘6’ on the other side, then this statement is true for it. Also, the statement is true, for example, for a card with ‘b’ and ‘4’, and for a card with ‘b’ and ‘3’ (since the letter is not a vowel). The statement is false, for example, for card with ‘e’ and ‘5’. You are interested if the statement is true for all cards. In particular, if no card has a vowel, the statement is true.

To determine this, you can flip over some cards to reveal the other side. You would like to know what is the minimum number of cards you need to flip in the worst case in order to verify that the statement is true.
Input

The first and only line of input will contain a string s (1 ≤ |s| ≤ 50), denoting the sides of the cards that you can see on the table currently. Each character of s is either a lowercase English letter or a digit.
Output

Print a single integer, the minimum number of cards you must turn over to verify your claim.
Examples
Input

ee

Output

2

Input

z

Output

0

Input

0ay1

Output

2

Note

In the first sample, we must turn over both cards. Note that even though both cards have the same letter, they could possibly have different numbers on the other side.

In the second sample, we don’t need to turn over any cards. The statement is vacuously true, since you know your friend has no cards with a vowel on them.

In the third sample, we need to flip the second and fourth cards.

大概 是一个模拟题 题目要求是这个牌要求一面是元音字母另一面就必须是偶数但是现在只有牌的一面露出 我想话最小的翻牌代价确定这个牌是否符合我的要求 所以我直接循环一下 判断是否是奇数和是否是元音字母即可


#include<cstdio>
#include<cstring>
char s[110];
int main(){
//  freopen("cfa.in","r",stdin);
    scanf("%s",s+1);int n=strlen(s+1),ans=0;
    for (int i=1;i<=n;++i){
        if (s[i]<='9'&&s[i]>='0'){
            if((s[i]-'0')%2)++ans;continue;
        }
        if (s[i]=='a') ++ans;
        if (s[i]=='e') ++ans;
        if (s[i]=='i') ++ans;
        if (s[i]=='o') ++ans;
        if (s[i]=='u') ++ans;
    }printf("%d\n",ans);
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值