HDU 1039(水题)
来源:互联网 发布:户外驴友用哪个软件 编辑:程序博客网 时间:2024/06/06 13:08
题意:如题。
#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <iostream>using namespace std;bool vowel(char c){ return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';}bool consonant(char c){ return !vowel(c);}bool except(char c){ return c != 'e' && c != 'o';}void deal(string& line){ bool vowel_exist = false; bool ok = true; for (int i = 0; i < line.length() && ok; ++i) { if (vowel(line[i])) { vowel_exist = true; if (i < line.length()-2 && vowel(line[i+1]) && vowel(line[i+2])) ok = false; } else { if (i < line.length()-2 && consonant(line[i+1]) && consonant(line[i+2])) ok = false; } if (i < line.length()-1 && line[i] == line[i+1] && except(line[i])) ok = false; } if (!vowel_exist) ok = false; cout << "<" << line << ">" << " is " << (ok ? "" : "not ") << "acceptable." << endl;}int main(){ //freopen("1.txt", "r", stdin); string line; while (getline(cin, line)) { if (line == "end") break; deal(line); } return 0;}
0 0
- HDU 1039(水题)
- HDU 1039
- hdu 1039
- hdu 1039
- hdu(1039)
- hdu 1039
- hdu 1039
- HDU-1039
- hdu 1039
- HDU-1039
- hdu 1039
- hdu水题
- hdu 水题
- HDU 1039 字符串判断(水题)
- HDU-1039 字符串处理
- HDU 1039 - Check Words
- HDU 1800(水题!!! @@)
- hdu 1231 DP水题
- USB Phy/ULPI (2-读写USB Phy寄存器)
- 随便写了个堆排序程序
- iOS 第三方控件GIFView的学习记录
- 学习grep命令时候遇到的问题
- C++中cin、cin.get()、cin.getline()、getline()、gets()等函数的用法
- HDU 1039(水题)
- Cocos2d-x3.0(一)Cocos2d-x3.0简介以及创建新的Cocos2d-x跨平台工程
- 【北京圣思园学习笔记】第04讲:运算符(Operator)
- Android四大组件(摘要)
- Nginx开启Gzip压缩大幅提高页面加载速度及相关测试
- 三种注释
- Windows下Hook API技术(hook send)
- HDU 1040(水题)
- 从skyeye学习arm( 工具篇)