A. Sleuth
来源:互联网 发布:人工智能黑科技是什么 编辑:程序博客网 时间:2024/06/05 22:34
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
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.
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.
Is it a melon?
NO
Is it an apple?
YES
Is it a banana ?
YES
Is it an apple and a banana simultaneouSLY?
YES
解题说明:此题只需要判断字符串中最后一个非空格和标点的字母是不是元音字母即可,用Gets读取字符串比较简单。
#include <iostream>#include<algorithm>#include<fstream>#include<cstdio>#include<cstring>using namespace std;int main(){char a[103],c;int length,i;gets(a);length=strlen(a);for(i=length-2;i>=0;i--){if(a[i]!=' '){c=a[i];break;}}if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U'||c=='Y'){printf("YES\n");}else{printf("NO\n");}return 0;}
- A. Sleuth
- 【水字符操作】#46 A. Sleuth
- The Sleuth Kit
- Sleuth.js - 想用啥就用啥
- Spring Cloud Sleuth 教程
- Spring Cloud Sleuth
- Spring cloud sleuth
- Spring Cloud Sleuth使用简介
- Spring Cloud Sleuth使用简介
- 全链路spring cloud sleuth+zipkin
- Spring Cloud Sleuth进阶实战
- Sleuth 服务链路跟踪
- Spring Cloud Sleuth+Zipkin实践
- Spring Cloud Sleuth进阶实战
- Spring Cloud Sleuth进阶实战
- Xenu's Link Sleuth 的使用
- spring cloud 使用sleuth +zipkin 实例测试
- 使用Spring Cloud Sleuth跟踪微服务
- BCGControlBar(MFC) v21发布支持Windows 8.1预览版
- hdu 1038(ACM steps 1.2.1)Biker's Trip Odometer
- 在线试用OA系统
- CreateCompatibleDC函数的使用
- 关于apache mod_unique_id 故障
- A. Sleuth
- Magento安装OneStepCheckOut一步支付插件遇到的问题--下篇
- HDU 4585 Shaolin (STL)
- LAMP环境编译
- 风雨哈佛路
- tmake的使用
- LIB和DLL的区别与使用
- sqlserver存储过程创建以及应用
- cloud foundry vmc push应用时NoMethodError: undefined method `buildpack' for #<CFoundry::V1::App 'hello'