[CF908X]Goodbye 2017!(ABC)(更新中)

Posted studyingfather

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[CF908X]Goodbye 2017!(ABC)(更新中)相关的知识,希望对你有一定的参考价值。

最近Codeforces放了个彩蛋,让我们这几天可以改一下名字的颜色,还送给我们一次改名机会(然而这个并没有什么卵用)。

于是一个快要成newbie的人,成功让自己变身红名user:)

技术分享图片


然而还是回到残忍的现实,看一下“美好”的“Goodbye 2017”比赛(表示本蒟蒻第二题都炸了)。

A: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.

大意:给出几张卡片(可能数字在上或字母在上),你的friend提出了一个命题:“所有元音字母卡片,它背面的数字都是偶数。”算出要验证这个命题,至少要翻多少张卡片。

题解:其实题目就是判断字符串中a,e,i,o,u,1,3,5,7,9的个数(辅音字母背面的数字是奇数或是偶数不重要),题意理解了一切就简单了。

技术分享图片
 1 #include <stdio.h>
 2 #include <string.h>
 3 char s[55];
 4 int main()
 5 {
 6  int len,ans=0;
 7  scanf("%s",s);
 8  len=strlen(s);
 9  for(int i=0;i<len;i++)
10  {
11   char c=s[i];
12   if(c>=0&&c<=9)
13   {
14    int num=c-0;
15    if(num%2)ans++;
16   }
17   else if(c==a||c==e||c==i||c==o||c==u)ans++;
18  }
19  printf("%d",ans);
20  return 0;
21 }
View Code

以上是关于[CF908X]Goodbye 2017!(ABC)(更新中)的主要内容,如果未能解决你的问题,请参考以下文章

CodeForces Goodbye 2017

Goodbye 2017 Solution

see goodbye with 2017

cf 1082abc

Good Bye 2018(待更新)

CF 1091E New Year and the Factorisation Collaboration