B. Verse Pattern

题目连接:

http://codeforces.com/contest/722/problem/B

Description

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 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).

Sample Input

3

2 2 3

intel

code

ch allenge

Sample Output

YES

Hint

题意

给你n个字符串,然后问你每个字符串里面是否恰好有p[i]个元音字母。

如果都符合的话,输出yes,否则输出no

题解:

暴力去判断就好了

代码

#include<bits/stdc++.h>
using namespace std;
const int maxn = 105;
int p[maxn];
string s;
int dp[2][maxn];
int main()
{
int now=0,pre=1;
int n;scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&p[i]);
int flag = 1;getchar();
for(int i=1;i<=n;i++)
{
getline(cin,s);
int k = 0;
for(int j=0;j<s.size();j++)
{
if(s[j]=='a'||s[j]=='e'||s[j]=='i'||s[j]=='o'||s[j]=='u'||s[j]=='y')
k++;
}
if(k!=p[i])flag=0;
}
if(flag)cout<<"YES"<<endl;
else cout<<"NO"<<endl; }

Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) B. Verse Pattern 水题的更多相关文章

  1. Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) A B C D 水 模拟 并查集 优先队列

    A. Broken Clock time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  2. Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)

    A. Broken Clock time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  3. Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)(set容器里count函数以及加强for循环)

    题目链接:http://codeforces.com/contest/722/problem/D 1 #include <bits/stdc++.h> #include <iostr ...

  4. 二分 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D

    http://codeforces.com/contest/722/problem/D 题目大意:给你一个没有重复元素的Y集合,再给你一个没有重复元素X集合,X集合有如下操作 ①挑选某个元素*2 ②某 ...

  5. 线段树 或者 并查集 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C

    http://codeforces.com/contest/722/problem/C 题目大意:给你一个串,每次删除串中的一个pos,问剩下的串中,连续的最大和是多少. 思路一:正方向考虑问题,那么 ...

  6. Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D. Generating Sets 贪心

    D. Generating Sets 题目连接: http://codeforces.com/contest/722/problem/D Description You are given a set ...

  7. Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C. Destroying Array 带权并查集

    C. Destroying Array 题目连接: http://codeforces.com/contest/722/problem/C Description You are given an a ...

  8. Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) A. Broken Clock 水题

    A. Broken Clock 题目连接: http://codeforces.com/contest/722/problem/A Description You are given a broken ...

  9. Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C. Destroying Array

    C. Destroying Array time limit per test 1 second memory limit per test 256 megabytes input standard ...

随机推荐

  1. 流媒体技术学习笔记之(十四)FFmpeg进行笔记本摄像头+麦克风实现流媒体直播服务

    FFmpeg推送视频流,Nginx RTMP模块转发,VLC播放器播放,实现整个RTMP直播 查看本机电脑的设备 ffmpeg -list_devices true -f dshow -i dummy ...

  2. 一个ssm综合小案例-商品订单管理-第二天

    准确来说是第二三天,一时兴起,把这个小项目一鼓作气写完了(较大的bug 均已被我手动捉出并 fix )才来写一篇博客. 接上文 第一天配置继续讲解:

  3. 【问题收集·中级】关于指示器自定义图片与UUID

    博友问题: 大哥 求教一下 iOS7 能否获取到 uuid 大哥 忙不忙 iOS的加载的时候 动态旋转效果 是 图片 嘛 ? 我的回答 05:43:34hud指示器我用的是这个MBProgressHU ...

  4. requests下载文件并重新上传

    import re import requests from io import BytesIO from django.core.files.uploadedfile import InMemory ...

  5. CSS background汇总

    本文更新版本 ,请跳转 所有背景属性都不能继承. 1.    background-color 所有元素都能设置背景颜色. background-color的默认值是transparent:也就是说, ...

  6. 爬虫、框架scrapy

    阅读目录 一 介绍 二 安装 三 命令行工具 四 项目结构以及爬虫应用简介 五 Spiders 六 Selectors 七 Items 八 Item Pipeline 九 Dowloader Midd ...

  7. SpringMVC JSON数据交互

    本节内容: @RequestBody @ResponseBody 请求json,响应json实现 前端可以有很多语言来写,但是基本上后台都是java开发的,除了c++(开发周期长),PHP和#Net( ...

  8. 启动spark集群

    启动Spark集群 spark@master $ ./sbin/start-all.sh 也可以一台一台启动,先启动 master spark@master $ ./sbin/start-master ...

  9. 022 StringTokenizer替换掉String的操作

    一:说明 1.说明 String的操作特别消耗内存,所以可以考虑优化. 二:程序 1.程序修改 这部分程序属于Mapper端的程序,稍微优化一下. 2.程序 //Mapper public stati ...

  10. vim/sed/awk/grep等文件批处理总结

    Vim相关操作 1.基础 * 和 # 对对当前光标所在的单词进行搜索 %匹配括号移动,包括 (, {, [ K 查看man手册 ga 查看ascii值 g CTRL-G 统计字数,使用Visual模式 ...