ans

Thanos 2020-08-06 16:51:17 2020-08-06 16:51:31 12 返回题目

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a[10000], b[10000];
int c = 0, n, max, h, k, i = -1, j = 0;
while (a[i] != -1) {
    i++;
    cin >> a[i];
    b[i] = a[i];
}
n = i - 1;
cin >> k;
for (int i = 0; i <= n; ++i)
    if (a[i] == k) {
        k = i;
        break;
    }
{
    for (int i = 0; i <= k; i++) cout << a[i] << " ";
    for (int j = k - 1; j >= 0; j--) cout << a[j] << " ";

    for (int i = 0; i <= n; ++i) cout << a[i] << " ";
}
return 0;

}

{{ vote && vote.total.up }}