codeforces722B
Verse Pattern
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of lines in the text.
The second line contains integers p1, ..., pn (0 ≤ pi ≤ 100) — the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
3
2 2 3
intel
code
ch allenge
YES
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
NO
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
sol:看懂题意后这道题TMD就是到手速题,对于第i个字符串,询问其中元音字母个数是否等于ai。。。
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
ll s=;
bool f=;
char ch=' ';
while(!isdigit(ch))
{
f|=(ch=='-'); ch=getchar();
}
while(isdigit(ch))
{
s=(s<<)+(s<<)+(ch^); ch=getchar();
}
return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
if(x<)
{
putchar('-'); x=-x;
}
if(x<)
{
putchar(x+''); return;
}
write(x/);
putchar((x%)+'');
return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
const int N=;
int n,a[N];
string S;
int main()
{
int i,j;
R(n);
for(i=;i<=n;i++) R(a[i]);
for(i=;i<=n;i++)
{
getline(cin,S);
int Len=S.size(),cnt=;
for(j=;j<Len;j++) if(S[j]=='a'||S[j]=='e'||S[j]=='i'||S[j]=='o'||S[j]=='u'||S[j]=='y') cnt++;
if(cnt!=a[i]) return *puts("NO");
}
puts("YES");
return ;
}
/*
input
3
2 2 3
intel
code
ch allenge
output
YES input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
output
NO input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
output
YES
*/
codeforces722B的更多相关文章
随机推荐
- object detection[rfcn]
0 - 背景 从rcnn,spp,fast rcnn, faster rcnn,yolo,ssd,这里又有个新模型叫rfcn,即Region-based Fully Convolutional Net ...
- input表单提交完毕,返回重新填入有黄色背景,和 历史记录 清除
<input autocomplete="value"> // 添加这个属性,可以解决然后添加一个css input:-webkit-autofill {box-sha ...
- 理解MySql的锁&事务隔离级别
这几篇文章是从网上(http://www.hollischuang.com)看到的一系列文章,也是重温了一下数据库的相关知识.下面是对这些文章的一些前后行文逻辑的说明: 我们知道,在DBMS的多个事业 ...
- eclipse不能运行Struts2项目
刚接触Struts2项目,本想写个HelloWorld上手,谁知道光eclipse配置tomcat就鼓捣一晚上,查阅各种资料. 项目刚开始报错: "java.lang.ClassNotFou ...
- 基于ASP.NET 4.0开发的微商城系统OdnShop,开源发布
基于ASP.NET 4.0开发的开源微商城系统,我们的目标是构建一个核心完善而又轻量级的微商城平台,目前基本的核心功能,包括微信登陆/支付,产品管理,购物车与订单管理等,轻量级是为了更加便于理解源码和 ...
- 避免使用HttpClient的系统代理
这两天在玩Consul, 他的.Net驱动使用了HttpClient来发送Http请求. 但是我的电脑上装有SS, 所以请求会被SS过滤一次, 然后导致请求的延迟一直比较高. 然后只需要改写一下Htt ...
- import导入模块,==和is,浅拷贝和深拷贝,进制转换,位运算,私有化,property装饰器
'''import导入模块'''import sysprint(sys.path) sys.path.append('D://ASoft/Python/PycharmProjects')import ...
- 抽象代数-p22商群
G/e={g{e}|g∈G}={{g}|g∈G}=G G/G={gG|g∈G}={G} (gG=G左乘g是G上的双射,它的逆映射是左乘g^-1) 所以 G/G 只有一个元素,所有G 就只能是 ...
- 实验楼----PHP大法
地址:http://www.shiyanbar.com/ctf/2008 题目:http://ctf5.shiyanbar.com/DUTCTF/index.php
- [转帖]Windows 操作系统有哪些原生的工具和软件不被人了解却很有用?
Windows 操作系统有哪些原生的工具和软件不被人了解却很有用? 蛋蛋 司马米青E1E1九木 https://www.zhihu.com/question/25343481/answer/30798 ...