Pagini recente » Cod sursa (job #1379346) | Cod sursa (job #1290458) | Istoria paginii runda/ivegotabrothernamedlee/clasament | Istoria paginii runda/pentru_fete_valcea/clasament | Cod sursa (job #1378003)
#include<iostream>
#include<fstream>
#include<algorithm>
using namespace std;
long long int n;
void Citire()
{
ifstream fin("kfib.in");
fin>>n;
fin.close();
}
int KFib(int n)
{
long long int x,y,aux,i;
if (n==1)
return 1;
if (n==2)
return 1;
x=1; y=1;
for (i=3;i<=n;i++)
{
aux=(x+y)%666013;
x=y%666013;
y=aux%666013;
}
return y;
}
void Afisare()
{
long long int x;
ofstream fout("kfib.out");
x=KFib(n);
fout<<x;
fout.close();
}
int main ()
{
Citire();
Afisare();
return 0;
}