Cod sursa(job #2100429)

Utilizator bori2000Fazakas Borbala bori2000 Data 5 ianuarie 2018 17:04:47
Problema Al k-lea termen Fibonacci Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.3 kb
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;

int main()
{
    ifstream f("kfib.in");
    ofstream g("kfib.out");
    float n;
    f>>n;
    long long a=(5+sqrt(5))/10*pow((1+sqrt(5))/2, n-1)+(5-sqrt(5))/10*pow((1-sqrt(5))/2, n-1);
    g<<a<<endl;
    return 0;
}