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 ...
随机推荐
- java 异常报错总结
1.java.lang.ArithmeticException:这是算数异常 比如分母位0 2. java.lang.ArrayIndexOutOfBoundsException:数组下标越界异常 3 ...
- H5及微信中唤起app的解决方案
今天我们就来说说这个callapp-lib 我的接到的需求大概是这样的 如果检测到不是在app里面用webview打开的页面就会显示上面的立即打开按钮, 点击的话会判断是否在微信中, 如果在微信中打开 ...
- MHA的MySQL高可用方案实战
功能: 1)master的故障切换(keepalived VIP的飘移) 2)主从复制角色的提升和重新转向 其中master 对外提供写服务,备选master2(实际的slave提供读服务,slave ...
- webstorm_completion
js 使用yarn 安装声明定义文件 @types/xxx koa ==> @types/koa koa-router ==> @types/koa-router 安装webstorm中的 ...
- iview中Modal弹窗做form表单验证相关问题
在modal中初始化状态,点击确定弹窗消失. 有的时候表单验证就不希望立刻消失 在iview官网中有自定义页头页脚 可以直接自定义使用 另一种验证写法 serform: { ctCatelogue: ...
- vue上传阿里云图片组件
首先需要弄一个阿里云存储.然后配置一下.前端就可以直接上传图片并回显.可在父级组件定义上传图片类型以及大小.默认为500kb.样式可以自适应调整. <template> <div c ...
- 洛谷——P3833 [SHOI2012]魔法树
P3833 [SHOI2012]魔法树 题目背景 SHOI2012 D2T3 题目描述 Harry Potter 新学了一种魔法:可以让改变树上的果子个数.满心欢喜的他找到了一个巨大的果树,来试验他的 ...
- idea热更新配置
idea部署热启动如下,经过本人实验 在这里只能选择exploded因为它支持热部署 在这里选择如下 到这里已经完成热部署了,如果有问题欢迎反馈给我,我会及时回复
- (43). Spring Boot动态数据源(多数据源自动切换)【从零开始学Spring Boot】
在上一篇我们介绍了多数据源,但是我们会发现在实际中我们很少直接获取数据源对象进行操作,我们常用的是jdbcTemplate或者是jpa进行操作数据库.那么这一节我们将要介绍怎么进行多数据源动态切换.添 ...
- python库文件路径
python中import语句导入库文件路径可通过sys.path查看.写一个简单的小程序: import sys print sys.path 运行它,本机上得到的结果如下: ['', '/usr/ ...