题解 CF908A 【New Year and Counting Cards】 发表于 2019-01-17 更新于 2024-07-11 阅读次数: Waline: CF908A 【New Year and Counting Cards】题解。 这回是真正的题解了 其实思路楼上已经说过,我只是来一发C++的 代码: 123456789101112#include <bits/stdc++.h>using namespace std;string s;int ans;bool k[256];//我选择了用桶进行优化,这样减少了代码,也变快了int main(){ k['a']=k['o']=k['e']=k['i']=k['u']=k['1']=k['3']=k['5']=k['7']=k['9']=true;//打表,需要翻过来的定义为true(1) cin>>s; for (int i=0;i<s.size();i++)ans+=(k[s[i]]);//直接进行计算 cout<<ans; return 0;}