fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n, a[1005];
  4. int main(){
  5. cin >> n;
  6. for (int i = 0; i < n; i++){
  7. cin >> a[i];
  8. cout << a[i] << " ";
  9. } cout << endl;
  10. for (int i = n - 1; i >= 0; i--) cout << a[i] << " ";
  11. cout << endl;
  12. for (int i = 0; i < n; i+=2) cout << a[i] << " ";
  13. cout << endl;
  14. for (int i = 1; i < n; i+=2) cout << a[i] << " ";
  15. cout << endl;
  16. for (int i = 0; i < n - 1; i++) cout << a[i] + a[i + 1] << " ";
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5264KB
stdin
Standard input is empty
stdout