C - Haiku
Problem description
Haiku is a genre of Japanese traditional poetry.
A haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the second phrase should contain exactly 7 syllables, and the third phrase should contain exactly 5 syllables). A haiku masterpiece contains a description of a moment in those three phrases. Every word is important in a small poem, which is why haiku are rich with symbols. Each word has a special meaning, a special role. The main principle of haiku is to say much using a few words.
To simplify the matter, in the given problem we will consider that the number of syllable in the phrase is equal to the number of vowel letters there. Only the following letters are regarded as vowel letters: "a", "e", "i", "o" and "u".
Three phases from a certain poem are given. Determine whether it is haiku or not.
Input
The input data consists of three lines. The length of each line is between 1 and 100, inclusive. The i-th line contains the i-th phrase of the poem. Each phrase consists of one or more words, which are separated by one or more spaces. A word is a non-empty sequence of lowercase Latin letters. Leading and/or trailing spaces in phrases are allowed. Every phrase has at least one non-space character. See the example for clarification.
Output
Print "YES" (without the quotes) if the poem is a haiku. Otherwise, print "NO" (also without the quotes).
Examples
Input
- on codeforces
beta round is running
a rustling of keys
Output
- YES
Input
- how many gallons
of edo s rain did you drink
cuckoo
Output
- NO
解题思路:只要符合俳句(由“五-七-五”,共十七字音组成,题目要求这些字音是必须都是元音字母)就输出"YES",否则输出"NO",java水过!
AC代码:
- import java.util.Scanner;
- public class Main {
- final static char[] obk={'a','e','i','o','u'};
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String[] s1=scan.nextLine().split(" ");
- String[] s2=scan.nextLine().split(" ");
- String[] s3=scan.nextLine().split(" ");
- int n1=r(s1,0),n2=r(s2,0),n3=r(s3,0);
- if(n1==5&&n2==7&&n3==5)System.out.println("YES");
- else System.out.println("NO");
- }
- public static int r(String[] s,int n){
- for(int i=0;i<s.length;++i){
- for(int j=0;j<s[i].length();++j){
- for(int k=0;k<5;++k)
- if(s[i].charAt(j)==obk[k])n++;
- }
- }
- return n;
- }
- }
C - Haiku的更多相关文章
- 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition) (水水)
题目链接:http://abc042.contest.atcoder.jp/tasks/abc042_a Time limit : 2sec / Memory limit : 256MB Score ...
- [Arc058E] Iroha and Haiku
[Arc058E] Iroha and Haiku 题目大意 问有多少\(n\)个数的正整数序列,每个数在\([1,10]\)之间,满足存在\(x,y,z,w\)使得\(x\to y-1,y\to z ...
- 水题 Codeforces Beta Round #70 (Div. 2) A. Haiku
题目传送门 /* 水题:三个字符串判断每个是否有相应的元音字母,YES/NO 下午网速巨慢:( */ #include <cstdio> #include <cstring> ...
- Solution -「ARC 058C」「AT 1975」Iroha and Haiku
\(\mathcal{Description}\) Link. 称一个正整数序列为"俳(pái)句",当且仅当序列中存在连续一段和为 \(x\),紧接着连续一段和为 \(y ...
- Libpci库的调用
这几天发现在Redhat AS6.5 X86_64下用outl(index, 0xcf8)和inl(0xcfc)下读取PCIe配置空间是系统有时性的会hang, 于是去寻找解决方案,首先想到的是用/d ...
- iOS 资源大全
这是个精心编排的列表,它包含了优秀的 iOS 框架.库.教程.XCode 插件.组件等等. 这个列表分为以下几个部分:框架( Frameworks ).组件( Components ).测试( Tes ...
- 盘点国内程序员不常用的热门iOS第三方库:看完,还敢自称”精通iOS开发”吗?【转载】
综合github上各个项目的关注度与具体使用情况,涵盖功能,UI,数据库,自动化测试,编程工具等类型,看完,还敢自称”精通iOS开发”吗? https://github.com/syedhali/EZ ...
- IOS中文版资源库
Swift 语言写成的项目会被标记为 ★ ,AppleWatch 的项目则会被标记为 ▲. [转自]https://github.com/jobbole/awesome-ios-cn#librari ...
- github上所有大于800 star OC框架
https://github.com/XCGit/awesome-objc-frameworks#awesome-objc-frameworks awesome-objc-frameworks ID ...
随机推荐
- 发现是在IE6-IE9下,下列元素table,thead,tfoot,tbody,tr,col,colgroup,html,title,style,frameset的innerHTML属性是只读的
table ID="zhutiTable" html2="<tr></tr>": 的数据 setTableInnerHTML(docu ...
- P4047 [JSOI2010]部落划分(最小生成树)
题目描述 聪聪研究发现,荒岛野人总是过着群居的生活,但是,并不是整个荒岛上的所有野人都属于同一个部落,野人们总是拉帮结派形成属于自己的部落,不同的部落之间则经常发生争斗.只是,这一切都成为谜团了——聪 ...
- Exception总结
NO.1 java.lang.NullPointerException 程序遇上了空指针 NO.2 java.lang.ClassNotFoundException 指定的类不存在 NO.3 java ...
- Vue 安装教程
1.下载node.js https://nodejs.org/en/ 2.检查环境变量: npm init (初始化项目) npm i webpack vue vue-loader 安装依赖: npm ...
- Linux下几种文件传输命令
Linux下几种文件传输命令 sz rz sftp scp 最近在部署系统时接触了一些文件传输命令,分别做一下简单记录: 1.sftp Secure Ftp 是一个基于SSH安全协议的文件传输管理工具 ...
- 洛谷 P2155 BZOJ 2186 codevs 2301 [SDOI2008]沙拉公主的困惑
题目描述 大富翁国因为通货膨胀,以及假钞泛滥,政府决定推出一项新的政策:现有钞票编号范围为1到N的阶乘,但是,政府只发行编号与M!互质的钞票.房地产第一大户沙拉公主决定预测一下大富翁国现在所有真钞票的 ...
- 洛谷 P1378 油滴扩展
P1378 油滴扩展 题目描述 在一个长方形框子里,最多有N(0≤N≤6)个相异的点,在其中任何一个点上放一个很小的油滴,那么这个油滴会一直扩展,直到接触到其他油滴或者框子的边界.必须等一个油滴扩展完 ...
- linux 内核视频-英本网
01.Linux内核学习入门 http://v.youku.com/v_show/id_XNjc1NzEzODAw.html02.Linux内核介绍 http:// ...
- Codeforces Round #303 (Div. 2) E
五道水题,但要手快才好...我手慢了,E题目都没看完TAT.... 想了一发,很水,就是一遍Dijk即可,使用优先队列,同时记录由哪条边转移而来 #include <iostream> # ...
- js判断object的具体类型(或者说判断object的类class)
The JavaScript specification gives exactly one proper way to determine the class of an object: Objec ...