Raslboyy

Untitled

Apr 19th, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n;
  8.     cin >> n;
  9.     vector<int> a(n);
  10.     a[0] = 1;
  11.     if (n >= 2)
  12.         a[1] = 1;
  13.     for (int i = 2; i < n; i++)
  14.         a[i] = a[i-1] + a[i-2];
  15.     for (int i : a)
  16.         cout << i << " ";
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment