HDUOJ 1039
来源:互联网 发布:深圳益讯网络 编辑:程序博客网 时间:2024/04/30 17:06
#include <iostream>#include <string>#include <algorithm>#include <numeric>using namespace std ;bool isV(char c){ return c == 'a' || c=='e' || c == 'i' || c == 'o' || c == 'u';}bool isPass(string s){int num = 1 ;int flag = 0 ; for ( int i = 0 ; i < s.size();++i) { if (isV[s[i]]) { flag = 1 ; break ; } } int cnt1=0 , cnt2=0 ; if ( s.size() >=3 ) { for ( int i = 0 ; i < s.size()-2;++i) for ( int j = 0 ; j < 3 ; ++j) { if ( isV(s[i+j])) ++cnt1; else ++cnt2; } if ( cnt1 == 3 || cnt2 == 3) return false ; } if ( s.size()>=2) { for ( int i = 0 ; i < s.size();++i) if (s[i]== s[i+1] && (s[i] != 'e'|| s[i] != 'o')) return false ; } if ( flag) return true ; else return false ;}int main(){string s ;cin >> s ;while(s.compare("end")){if ( isPass(s) ) cout<<"<"<<s<<">"<<" is acceptable."<<endl; else cout<<"<"<<s<<">"<<" is not acceptable."<<endl;cin >> s ; }return 0 ;}一开始 想错了 以为是三个一样的元音字母 或者辅音 结果。。。。。
0 0
- HDUOJ 1039
- HDUOJ
- HDUoj
- HDUOJ 2050
- HDUOJ 2018
- HDUOJ 2069
- HDUOJ 1303
- HDUOJ 2031
- HDUOJ 2047
- HDUOJ 2089
- hduoj 1708
- hduoj 2031
- hduoj 2032
- hduoj 1062
- HDUOJ lines
- HDUOJ入门
- HDUOJ 水果
- hduoj 分类
- 下拉框封装
- (转载)Toast的五种效果
- HttpClient 认证机制
- Unity3d依赖于平台的编译
- SqlServer 还原差异备份失败:对应不上完整备份
- HDUOJ 1039
- Handler的定义:主要接受子线程发送的数据, 并用此数据配合主线程更新UI.
- runtime 机制
- 快速乘
- cocos2d-x-3.2 (一)两种方法画基本图形
- 安卓感知哈希算法
- github上优秀的android 开源项目
- 抽奖大转盘
- library search paths 路径带有空格,导致拆分成2个路径查询,出现ld: warning: directory not found for option错误