Source Code
#include <iostream>
#include <math.h>
using namespace std;

int fib(int n) {
    n++;
  double phi = (1 + sqrt(5)) / 2;
  return round(pow(phi, n) / sqrt(5));
}
int main()
{
    int t;
    cin >> t;
    while (t > 0)
    {
        int n;
        cin >> n;
        cout << fib(n) << endl;
        t--;
    }
}
Copy
Study Schedule Heromnxpw0
GNU G++17
219 ms
1.8 MB
Wrong Answer