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的更多相关文章
随机推荐
- docker部署nginx
1. 下载nginx [root@localhost my.Shells]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/ ...
- mybatis-高级结果映射之一对多
目录 1 数据准备 1.2 实体类, 接口和XML 2 一对多映射 2.1 collection集合映射 2.1.1 创建结果实体类 2.1.2 创建结果集 2.1.3 创建对应的方法和XML 2.1 ...
- .NET(C#)主流ORM总揽
前言 在以前的一篇文章中,为大家分享了<什么是ORM?为什么用ORM?浅析ORM的使用及利弊>.那么,在目前的.NET(C#)的世界里,有哪些主流的ORM,SqlSugar,Dapper, ...
- C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 增强服务安全、阻止非授权的用户非法调用
多一道防线,多一些安全保障,当程序发布到互联网上,再有成千上万的用户在用,总会有各种牛人出现,万一遇到破坏分子,那会有灾难性的打击. 只要跟利益有关系的,跟资金有关系,跟财务有关系,有竞争对手,软件系 ...
- Python-0010-
题目: 判断101-200之间有多少素数,并输出所有素数. 程序分析: 判断素数的方法:用一个数分别去除2到sqrt(这个数),如果能被整除则表明次数不是素数,反之是素数.用else 可以进一步简化代 ...
- H5 67-清除浮动方式三
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- hibernate操纵数据库常用方法 及 hibernate对象的三种状态
在dao层使用hibernate语言来与数据库进行访问,hibernate作为面向对象思想开发的dao层框架其理解也需要以面向对象的思想来看待 使用.hibernate不仅支持使用者使用他提供的对象来 ...
- P1525 关押罪犯
基础并查集-- #include<iostream> #include<string.h> #include<algorithm> #include<stdi ...
- hdu3294(马拉车模板)
注意:string会超时 #include<bits/stdc++.h> using namespace std; #define ll long long const double PI ...
- 计算Java List中的重复项出现次数
import java.util.ArrayList;import java.util.HashMap;import java.util.Iterator;import java.util.List; ...