B - Sleuth
Problem description
Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a "crime" and find out what is happening. He can ask any questions whatsoever that can be answered with "Yes" or "No". All the rest agree beforehand to answer the questions like that: if the question’s last letter is a vowel, they answer "Yes" and if the last letter is a consonant, they answer "No". Of course, the sleuth knows nothing about it and his task is to understand that.
Unfortunately, Vasya is not very smart. After 5 hours of endless stupid questions everybody except Vasya got bored. That’s why Vasya’s friends ask you to write a program that would give answers instead of them.
The English alphabet vowels are: A, E, I, O, U, Y
The English alphabet consonants are: B, C, D, F, G, H, J, K, L, M, N, P, Q, R, S, T, V, W, X, Z
Input
The single line contains a question represented by a non-empty line consisting of large and small Latin letters, spaces and a question mark. The line length does not exceed 100. It is guaranteed that the question mark occurs exactly once in the line — as the last symbol and that the line contains at least one letter.
Output
Print answer for the question in a single line: YES if the answer is "Yes", NO if the answer is "No".
Remember that in the reply to the question the last letter, not the last character counts. I. e. the spaces and the question mark do not count as letters.
Examples
Input
- Is it a melon?
Output
- NO
Input
- Is it an apple?
Output
- YES
Input
- Is it a banana ?
Output
- YES
Input
- Is it an apple and a banana simultaneouSLY?
Output
- YES
解题思路:简单判断一行中最后一个字母(非"?")是否为元音字母,如果是则输出"YES",否则输出"NO",水过!
AC代码:
- #include<bits/stdc++.h>
- using namespace std;
- const char obj[]={'a','A','e','E','i','I','o','O','u','U','y','Y'};
- bool fb(char ch){
- for(int i=;i<;++i)
- if(ch==obj[i])return true;
- return false;
- }
- int main(){
- char s[];gets(s);
- int len=strlen(s);
- for(int i=len-;i>=;--i){
- if((s[i]>='A'&&s[i]<='Z')||(s[i]>='a'&&s[i]<='z')){
- if(fb(s[i]))cout<<"YES"<<endl;
- else cout<<"NO"<<endl;
- break;
- }
- }
- return ;
- }
B - Sleuth的更多相关文章
- 使用Spring Sleuth和Zipkin跟踪微服务
随着微服务数量不断增长,需要跟踪一个请求从一个微服务到下一个微服务的传播过程, Spring Cloud Sleuth 正是解决这个问题,它在日志中引入唯一ID,以保证微服务调用之间的一致性,这样你就 ...
- 链接测试工具xenu link sleuth的使用
链接测试工具xenu link sleuth的使用很简单. 可以从这里下载 http://home.snafu.de/tilman/xenulink.html 但是注意到: 如果需要登录才能进入所有的 ...
- SpringCloud学习笔记(7)——Sleuth
Part VII. Spring Cloud Sleuth 46. Introduction Spring Cloud Sleuth为Spring Cloud实现了分布式的跟踪解决方案 46.1 Te ...
- springcloud(十二):使用Spring Cloud Sleuth和Zipkin进行分布式链路跟踪
随着业务发展,系统拆分导致系统调用链路愈发复杂一个前端请求可能最终需要调用很多次后端服务才能完成,当整个请求变慢或不可用时,我们是无法得知该请求是由某个或某些后端服务引起的,这时就需要解决如何快读定位 ...
- SpringCloud学习之sleuth&zipkin【二】
这篇文章我们解决上篇链路跟踪的遗留问题 一.将追踪数据存放到MySQL数据库中 默认情况下zipkin将收集到的数据存放在内存中(In-Memeroy),但是不可避免带来了几个问题: 在服务重新启动后 ...
- SpringCloud学习之sleuth&zipkin
一.调用链跟踪的必要性 首先我们简单来看一下下单到支付的过程,别的不多说,在业务复杂的时候往往服务会一层接一层的调用,当某一服务环节出现响应缓慢时会影响整个服务的响应速度,由于业务调用层次很“深”,那 ...
- Spring Cloud(十二):分布式链路跟踪 Sleuth 与 Zipkin【Finchley 版】
Spring Cloud(十二):分布式链路跟踪 Sleuth 与 Zipkin[Finchley 版] 发表于 2018-04-24 | 随着业务发展,系统拆分导致系统调用链路愈发复杂一个前端请 ...
- Spring Cloud Sleuth服务链路追踪(zipkin)(转)
这篇文章主要讲述服务追踪组件zipkin,Spring Cloud Sleuth集成了zipkin组件. 一.简介 Spring Cloud Sleuth 主要功能就是在分布式系统中提供追踪解决方案, ...
- SpringCloud(7)服务链路追踪Spring Cloud Sleuth
1.简介 Spring Cloud Sleuth 主要功能就是在分布式系统中提供追踪解决方案,并且兼容支持了 zipkin,你只需要在pom文件中引入相应的依赖即可.本文主要讲述服务追踪组件zipki ...
- 第八篇: 服务链路追踪(Spring Cloud Sleuth)
一.简介 一个分布式系统由若干分布式服务构成,每一个请求会经过多个业务系统并留下足迹,但是这些分散的数据对于问题排查,或是流程优化都很有限. 要能做到追踪每个请求的完整链路调用,收集链路调用上每个 ...
随机推荐
- vmware vSphere client中,选择文件->部署OVF模板,报错处理方法
在vmware vSphere client中,选择文件->部署OVF模板,选择指定的OVA文件,按步骤进行,则会出现这样的错误:此OVF软件包使用了不受支持的功能.OVF软件包需要不支持的硬件 ...
- Centos7自动式脚本搭建jumpserver
JumpServer脚本 这里需要安装阿里的yum源和epel源并解压: epel源地址https://mirrors.tuna.tsinghua.edu.cn/epel// 安装阿里互联网yum仓库 ...
- Oracle 【基 本 操 作】
1.日期时间 select SYSDATE from DUAl; select TO_CHAR(SYSDATE, 'YYYY-MM-DD') from DUAL; select TO_CHAR(SYS ...
- LVM(Logical Volume Manager)逻辑卷管理
本文实验部分,完全由本人亲自动手实践得来 文章中有部分的内容是我个人通过实验测试出来的,虽以目前本人的能力还没发现不通之处,但错误难免,所以若各位朋友发现什么错误,或有疑惑.更好的建议等,盼请各位能在 ...
- vue项目中的常见问题(vue-cli版本3.0.0)
一.样式问题 1.vue中使用less 安装less依赖 npm install less less-loader --save-dev 在使用时 在style标签中加入 lang="les ...
- hdu 5170 精度控制
众所周知,GTY是一位神犇,为了更好的虐场,他从来不写数学作业而是去屠题,他的数学老师非常不爽,但由于GTY每次考试都AK,她也不能说什么,有一天老师在黑板上写了四个数——a,b,c,da,b,c,d ...
- 如何应对SHA-1加密算法升级为SHA-256
经过权威机构证实,sha1加密算法的不安全性越来越高,sha指纹造假成本越来越低,随即微软.谷歌等IT巨头相继发布弃用sha1加密算法声明,第三方认证机构自2016年1月1日起,将全面停止签发SHA1 ...
- 【codeforces 515B】Drazil and His Happy Friends
[题目链接]:http://codeforces.com/contest/515/problem/B [题意] 第i天选择第i%n个男生,第i%m个女生,让他们一起去吃饭; 只要这一对中有一个人是开心 ...
- 【hdu 2036】改革春风吹满地
[题目链接]:http://acm.hdu.edu.cn/showproblem.php?pid=2036 [题意] 中文题 [题解] 这里用的是叉积对应的求三角形的面积; 即 A×B=A*B*sin ...
- 关于单CPU,多CPU上的原子操作
所谓原子操作,就是"不可中断的一个或一系列操作" . 硬件级的原子操作:在单处理器系统(UniProcessor)中,能够在单条指令中完成的操作都可以认为是" 原子操作& ...