Brucelee399
Ones'
2017-05-27 09:07

杭电acm1039我的代码为什么AC不了?

  • 杭电
  • acm
#include<iostream>
#include<string>

using namespace std;
int main()
{
    string in;
    char temp;
    int flag, flagv;
    int vowel = 0;
    int consonant = 0;
    while (cin >> in)
    {
        if (in == "end")
            break;
        flag = 1;
        flagv = 0;
        temp = '~';
        for (int i = 0; i < in.size(); i++)
        {
            if (in[i] == 'a'||in[i]=='e'||in[i]=='i'||in[i]=='o'||in[i]=='u')
            {
                consonant = 0;
                flagv = 1;
                    vowel++;
                if (vowel == 3)
                {
                    flag = 0;
                    break;
                }                   
            }
            else
            {
                vowel = 0;
                consonant++;
                if (consonant == 3)
                {
                    flag = 0;
                    break;
                }
            }
            if (temp == in[i] &&in[i]!='e'&&in[i]!='o')
            {
                flag = 0;
                break;
            }
            else
                temp = in[i];

        }
        cout << "<" << in << "> " << "is ";
        flag == 1&&flagv==1 ? cout << "acceptable" : cout << "not acceptable";
        cout << endl;
    }
    return 0;
}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答