fork download
  1.  
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int fib(int n)
  6. {
  7. if(n<=1)
  8. return n;
  9. return fib(n - 1) + fib(n - 2);
  10. }
  11.  
  12. int find(int n)
  13. { float fibo = 2.078087*log(n)+1.672276; return round(fibo);}
  14.  
  15. int main()
  16. {
  17. int m, n;
  18. cin >> n>>m;
  19. n=find(n);
  20. cout<<n<<endl;
  21. cout<<fib(n+m);
  22. }
Success #stdin #stdout 0.01s 5516KB
stdin
5 
3
stdout
5
21