Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std ;
- #define sz(s) int(s.size())
- typedef long long ll ;
- void ABDEL3AL () {
- ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
- #ifndef ONLINE_JUDGE
- freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
- #endif
- }
- int main() {
- ABDEL3AL() ;
- int n ; cin >> n ;
- int fib[n + 1] ;
- fib[1] = 0 , fib[2] = 1 ;
- for (int i = 3; i <= n; i++)
- fib[i] = fib[i - 1] + fib[i - 2] ;
- for (int i = 1; i <= n; i++)
- cout << fib[i] << " " ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment