Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- #include <limits.h>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int nn = n + 1;
- int *a = new int[nn];
- for(int i = nn - 1; i >= 0; i--) {
- cin >> a[i];
- }
- int b[] = {1, 0, 1};
- int m = 3;
- int *res = new int[nn + m - 1]; // 0-индексация
- for(int i = 0; i < m; i++) {
- for(int j = 0; j < nn; j++) {
- res[i + j] += b[i] * a[j];
- }
- }
- for(int i = 0; i < nn + m - 1; i++) {
- cout << res[i] << " " ;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment