Untitled

 avatar
NguyenAnhQuan
c_cpp
a year ago
727 B
3
Indexable
Never
#include <iostream>
#include <math.h>
#define Max 1000
using namespace std;

int c[Max];

void Input(int a[], int &n)
{
    cin >> n;

    for (int i = 1; i <= n; i++) cin >> a[i];
}

void Fun(int a[], int n)
{
    int flag = 0;

    for (int i = 2; i <= n; i++)
    {
        if (a[i - 1] > a[i])
        {
            if (c[i - 1] == 0) {c[i - 1] = 1; cout << a[i - 1] << " ";}
            cout << a[i] << " ";
            c[i] = 1;
            flag = 1;
        }
        else
        {
            if (c[i - 1] == 1) cout << "\n";
        }
    }

    if (flag == 0) cout << "No Find";
}

int main()
{
    int a[Max];
    int n;
    Input(a,n);
    Fun(a,n);
    return 0;
}