提交时间:2024-03-09 10:15:45
运行 ID: 136537
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 005; int a[N]; bool check(int i, int j) { for (int e = i; e < j; e++) if (a[e] > a[e + 1]) return false; return true; } void print(int i, int j) { for (int e = i; e <= j; e++) cout << a[e] << " "; cout << endl; } int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) if (check(i, j)) print(i, j); }