// print first n Fibonacci numbers #include #include #include #include using namespace std; int main () { int n; cin >> n; vector v (n); int a = 0, b = 1; generate (v.begin (), v.end (), [&] () {int c = a; a = b; b += c; return c;}); copy (v.begin (), v.end (), ostream_iterator (cout, " ")); return 0; }