Cod sursa(job #2701421)
Utilizator | Data | 31 ianuarie 2021 04:30:30 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.28 kb |
#include <iostream>
#include <math.h>
#include <fstream>
using namespace std;
ifstream f("kfib.in");
ofstream g("kfib.out");
int main()
{
double gr = (1 + sqrt(5))/2;
unsigned long long n;
f>>n;
g << ((pow(gr, n) - pow(1 - gr, n))/sqrt(5));
return 0;
}