Cod sursa(job #1846465)
Utilizator | Data | 12 ianuarie 2017 21:17:04 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include <fstream>
#include <math.h>
using namespace std;
ifstream cin("kfib.in");
ofstream cout("kfib.out");
int main()
{
long long k,x;
cin>>k;
x=(1/sqrt(5))*(pow((1+sqrt(5))/2,k)-pow((1-sqrt(5))/2,k));
cout<<x;
return 0;
}