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