codeforces 722B Verse Pattern
来源:互联网 发布:vnc 客户端 windows 编辑:程序博客网 时间:2024/04/28 13:09
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 1to 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.
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 100characters.
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).
水题统计元音个数就ok了;
AC代码:
# include <stdio.h># include <string.h>using namespace std;typedef long long int ll;int a[110], cnt;char ch[110];int value[200];int main(){ int i, j, k, n;char flage=' ';scanf("%d", &n);for(i=1; i<=n; i++){scanf("%d", &a[i]);}value['a']=1;value['e']=1;value['i']=1;value['o']=1;value['u']=1;value['y']=1;for(i=1; i<=n; i++){cnt=0;while(flage==' '){scanf("%s", ch);flage=getchar();int length=strlen(ch);for(j=0; j<length; j++){if(value[ch[j]]){cnt++;}}}if(cnt!=a[i]){printf("NO");return 0;}flage=' ';}printf("YES");return 0;}
- CodeForces 722B Verse Pattern
- codeforces 722B Verse Pattern
- codeforces 722 B. Verse Pattern
- 【57.14%】【codeforces 722B】Verse Pattern
- CodeForces 722B. Verse Pattern(模拟)
- Verse Pattern Codeforces Intel Round-B
- coderforces B. Verse Pattern 字符处理
- Codeforces722 B. Verse Pattern (水题)
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) -- B. Verse Pattern(水题)
- 【Intel Code Challenge Elimination Round (Div1 + Div2, combined) B】【水题】Verse Pattern
- B/S verse C/S
- codeforces 412C Pattern
- codeforces B
- codeforces B
- codeforces B
- codeforces B
- Codeforces 412C Pattern(暴力)
- Codeforces C. Pattern 412 题解
- 新特性AAtitti css3 新特性attilax总结titti css
- Uva1151
- Linux进程间通信——so共享库的使用学习笔记
- 【c++】课设实验报告
- Atitit.java图片图像处理attilax总结
- codeforces 722B Verse Pattern
- 八大排序--冒泡排序
- js实现自定义滚动条
- 移动互联网从业者的第一本工具使用手册——《移动互联网之路》
- 单向链表
- Atitit 在线支付系统功能设计原理与解决方案 与目录
- MySQL 绿色版 乱码解决方法
- ie以及ie内核浏览器连不上网,其他浏览器可以,部分软件连不上网的解决办法
- 基于zigbee技术室内定位解决方案的探索(一)