0
已解决
陶春光
中级守护
中级守护
5130:折叠数组1 报Wrong answer
- #include <iostream> using namespace std; int a[101]; int main() { int n; cin >> n; if (n < 1 || n > 100) return 0; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n / 2; i++) { a[n - i - 1] += a[i]; } for (int i = n / 2; i < n; i++) { cout << a[i] << " "; } return 0; }