链接地址是:http://acm.zju.edu.cn/show_problem.php?pid=1698
在IE下不知道为何不能正常显示这个写新文章,现在是在opera下发表的,不知道会显示成什么样子.好长时间没有写文章了,一来就是搞ACM上的简单题目.其实人生的一个小乐趣又何尝不是不爽的时候切简单的题目呢??
代码如下:
#include
<
iostream
>
using namespace std;
int main()
{
char ch,array[ 20 ];
int position;
bool tag = false ;
position = 0 ;
while (tag == false )
{
ch = getchar();
if (ch != ' ' )
{
array[position ++ ] = ch;
}
else if (ch == ' ' )
{
if (array[ 0 ] == ' e ' && array[ 1 ] == ' n ' && array[ 2 ] == ' d ' )
{
tag = true ;
}
else
{
bool get = false ;
for ( int i = 0 ;i < position; ++ i)
{
if (array[i] == ' a ' || array[i] == ' e ' || array[i] == ' i ' ||
array[i] == ' o ' || array[i] == ' u ' )
{
get = true ;
break ;
}
}
if ( get == false )
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is not acceptable. " << endl;
}
else
{
get = false ;
int count = 0 ;
for ( int i = 0 ;i < position; ++ i)
{
if (count >= 3 )
{
break ;
}
if (array[i] == ' a ' || array[i] == ' e ' || array[i] == ' i ' ||
array[i] == ' o ' || array[i] == ' u ' )
{
if ( get == false )
{
++ count;
}
else
{
get = false ;
count = 1 ;
}
}
else
{
if ( get == false )
{
get = true ;
count = 1 ;
}
else
{
++ count;
}
}
}
if (count >= 3 )
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is not acceptable. " << endl;
}
else
{
int i = 0 ;
for (i = 1 ;i < position; ++ i)
{
if (array[i - 1 ] == array[i])
{
if (array[i] != ' o ' && array[i] != ' e ' )
{
i = - 1 ;
break ;
}
}
}
if (i == - 1 )
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is not acceptable. " << endl;
}
else
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is acceptable. " << endl;
}
}
}
}
position = 0 ;
}
}
return 0 ;
}
using namespace std;
int main()
{
char ch,array[ 20 ];
int position;
bool tag = false ;
position = 0 ;
while (tag == false )
{
ch = getchar();
if (ch != ' ' )
{
array[position ++ ] = ch;
}
else if (ch == ' ' )
{
if (array[ 0 ] == ' e ' && array[ 1 ] == ' n ' && array[ 2 ] == ' d ' )
{
tag = true ;
}
else
{
bool get = false ;
for ( int i = 0 ;i < position; ++ i)
{
if (array[i] == ' a ' || array[i] == ' e ' || array[i] == ' i ' ||
array[i] == ' o ' || array[i] == ' u ' )
{
get = true ;
break ;
}
}
if ( get == false )
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is not acceptable. " << endl;
}
else
{
get = false ;
int count = 0 ;
for ( int i = 0 ;i < position; ++ i)
{
if (count >= 3 )
{
break ;
}
if (array[i] == ' a ' || array[i] == ' e ' || array[i] == ' i ' ||
array[i] == ' o ' || array[i] == ' u ' )
{
if ( get == false )
{
++ count;
}
else
{
get = false ;
count = 1 ;
}
}
else
{
if ( get == false )
{
get = true ;
count = 1 ;
}
else
{
++ count;
}
}
}
if (count >= 3 )
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is not acceptable. " << endl;
}
else
{
int i = 0 ;
for (i = 1 ;i < position; ++ i)
{
if (array[i - 1 ] == array[i])
{
if (array[i] != ' o ' && array[i] != ' e ' )
{
i = - 1 ;
break ;
}
}
}
if (i == - 1 )
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is not acceptable. " << endl;
}
else
{
cout << " < " ;
for ( int i = 0 ;i < position; ++ i)
{
cout << array[i];
}
cout << " > is acceptable. " << endl;
}
}
}
}
position = 0 ;
}
}
return 0 ;
}