fork download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int N;
  8. int tr[10001];
  9.  
  10. cin >> N;
  11.  
  12. tr[0] = 1;
  13. tr[1] = 1;
  14.  
  15. for (int i = 2; i <= N; i++)
  16. {
  17. tr[i] = tr[i - 1] + tr[i - 2];
  18. }
  19.  
  20. cout << tr[N-1] << endl;
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 4352KB
stdin
7
stdout
13