note문제인데 왜일까요?? 답이랑 똑같이 나오는데..ㅠㅠ

  • User Avatar
    ParkHoYong

    wa떠요
    ~~~ cpp

    #include
    #include
    using namespace std;

    int main()
    {
    unsigned int value_int[8];
    int lis,listemp;

    for(unsigned int c=0;c<3;c++)
    {
    cout<<"Example "<<c+1<<endl;
    for(unsigned int m=0;m<8;m++)
    {
    scanf("%d",&value_int[m]);
    }
    //cout<<endl;
    lis=1;

    listemp=1;
    for(unsigned int j=1;j<8;j++)
    {
      if(value_int[j-1]<value_int[j])
      {
        listemp++;
        if(listemp>lis)
        {
          lis=listemp;
        }
      }
      else if(value_int[j-1]>value_int[j])
      {
        listemp--;
        if(listemp<lis)
        {
          lis=listemp;
        }
    
      }
      else
      {
        listemp=1;
      }
    }
    cout<<"Example "<<c+1<<endl;
    if(lis==8)
    {
      cout<<"ascending"<<endl;
    }
    else if(lis==-6)
    {
      cout<<"descending"<<endl;
    }
    else
    {
      cout<<"mixed"<<endl;
    }
    

    // if(c==2)
    // {
    //
    // }
    // else
    // cout<<endl;
    }
    return 0;
    }


    15년 전
3개의 댓글이 있습니다.
  • User Avatar
    hyunhwan

    입력은 하나만 받는게 맞고, Example이라는게 출력되는건 아니랍니다. 그냥 아래의 숫자들만 출력되는거고, 입력은 딱 하나의 수열만 받게 됩니다.


    15년 전 link
  • User Avatar
    VOCList

    예제 인풋과 아웃풋 3개를 문제에서 제공해준다고 보시면 됩니다. 실제로는 하나만 들어오는거에요.


    15년 전 link
  • User Avatar
    ParkHoYong

    ㅠㅠ리베님 VOCList님 감사합니다...눈물날꺼같아요!!


    15년 전 link
  • 정회원 권한이 있어야 커멘트를 다실 수 있습니다. 정회원이 되시려면 온라인 저지에서 5문제 이상을 푸시고, 가입 후 7일 이상이 지나셔야 합니다. 현재 문제를 푸셨습니다.