#include <bits/stdc++.h>
using namespace std; int a[1001]; int main() { int n, sum = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } cout << sum << endl;
for (int i = n; i >= 1; i--) {
cout << a[i] << " ";
}
cout << endl;
int max = a[1], maxi = 1;
for (int i = 2; i <= n; i++) {
if (a[i] > max) {
max = a[i];
maxi = i;
}
}
cout << max << " " << maxi;
cout << endl;
int min = a[1], mini = 1;
for (int i = 2; i <= n; i++) {
if (a[i] <= min) {
min = a[i];
mini = i;
}
}
cout << min << " " << mini;
int ans = 0;
for (int i = 1; i <= n; i++) {
if (a[i] > 10 && a[i] < 100)
ans++;
}
cout << ans << " ";
for (int i = 1; i <= n; i++) {
if (a[i] > 10 && a[i < 100])
cout << a[i] << " ";
}
cout << endl;
int x, y;
cin >> x >> y;
for (int i = n; i >= x; i--) a[i + 1] = a[i];
a[x] = y;
for (int i = 1; i <= n + 1; i++) cout << a[i] << endl;
int k;
for (int i = k; i <= n; k++) a[i] = a[i + 1];
for (int i = 1; i <= n; i++) cout << a[i] << " ";
return 0;
}
共 4 条回复
🐶
不保证AC哟()
@CPP 👍
k++
应该为i++