Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) B. Verse Pattern 水题
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 水题的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 二分 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D
http://codeforces.com/contest/722/problem/D 题目大意:给你一个没有重复元素的Y集合,再给你一个没有重复元素X集合,X集合有如下操作 ①挑选某个元素*2 ②某 ...
- 线段树 或者 并查集 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C
http://codeforces.com/contest/722/problem/C 题目大意:给你一个串,每次删除串中的一个pos,问剩下的串中,连续的最大和是多少. 思路一:正方向考虑问题,那么 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- day64_SpringMVC学习笔记_02
1.springmvc对多视图的支持 (1)导入xml格式视图支持的jar包 注意:springmvc本身就支持xml格式,所以不用导入其他支持的jar包了. (2)在springmvc.xml中 ...
- 跨域请求:JSONP
在JavaScript中,有一个很重要的安全性限制,被称为"同源策略".即JavaScript只能访问与包含它的文档在同一域下的内容.然而,当进行一些比较深入的前端编程的时候,不可 ...
- Myeclipse 工具优化 [内存一直增加, jsp,javascript 编辑很卡]
首先看这篇随笔 地址: Myeclipse/STS 首次在本地部署配置一个Spring MVC 项目 (十二) [http://www.cnblogs.com/editor/p/3915239.htm ...
- PyQT5 No module named ‘PyQt5.QtWebEngineWidgets’
PyQT5查找不到模块QtWebEngineWidgets pip install pyqt5==5.10.1 或 安装64位的Pyhon解释器
- USB的挂起和唤醒(Suspend and Resume)【转】
转自:http://m.blog.csdn.net/blog/luckywang1103/25244091 USB协议的第9章讲到USB可见设备状态[Universal Serial Bus Spec ...
- opencv SVM多分类 人脸识别
上一篇介绍了OPENCV中SVM的简单使用,以及自带的一个二分类问题. 例子中的标签是程序手动写的,输入也是手动加的二维坐标点. 对于复杂问题就必须使用数据集中的图片进行训练,标签使用TXT文件或程序 ...
- 阿里云服务器配置nginx和PHP
1. 安装及启动nginx 输入yum install nginx命令进行nginx的安装,当需要确认时输入”y“确认. yum install nginx 安装完成后,输入service nginx ...
- vim 如何与外界粘贴复制
在学习使用vim 的过程序,我们知道在vim 里面,粘贴复制的命令是y/p ,但是我们总会碰到这样的问题:如何把vim 里面复制的内容粘贴到vim 之外或者把vim 外面复制的内容粘贴到vim 里面? ...
- hdu 2923 map+Floyd 拉破车
有向图 具体方向看箭头 从起点到指定城市拉破车,一个城市可能有多个破车,一次只能拉一辆破车 也就是到了指定地点后要回到起点 假如有100辆破车 但是只有一个城市有 就得在起点与这个城市间往返100次所 ...
- kafka 查看队列信息
https://blog.csdn.net/getyouwant/article/details/81209286?utm_source=blogxgwz8