Cod sursa(job #2347484)
| Utilizator | Data | 18 februarie 2019 20:27:12 | |
|---|---|---|---|
| Problema | Al k-lea termen Fibonacci | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <string.h>
using namespace std;
int const MOD = 666013;
int fiboNum(int k) {
int term1 = 1, term2 = 1, result;
for(int i = 3; i <= k; i++) {
result = (1LL * (term1 + term2)) % MOD;
term1 = (1LL * term2) % MOD;
term2 = (1LL * result) % MOD;
}
return result;
}
int main() {
ifstream fin("kfib.in");
ofstream fout("kfib.out");
int k;
fin >> k;
fout << k;
return 0;
}
