acm zju 1698

链接地址是: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 ;
}
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值