Pagini recente » Cod sursa (job #1345612) | Cod sursa (job #266155) | Cod sursa (job #230555) | Cod sursa (job #2946403) | Cod sursa (job #2025322)
#include <cstdio>
using namespace std;
const int BASE = 10;
const int DIG = 211;
unsigned char a[DIG], b[DIG];
int main()
{
int n, j, x;
fscanf(fopen("nunta.in", "r"), "%d", &n);
a[0] = a[1] = b[0] = b[1] = 1;
for (int i = 1; i < n; ++i) {
int t = 0;
for (j = 1; j <= b[0] || t; ++j, t /= BASE) {
x = b[j];
b[j] = (t += a[j] + b[j]) % BASE;
a[j] = x;
}
a[0] = b[0];
b[0] = j - 1;
}
FILE *fout = fopen("nunta.out", "w");
for (int i = b[0]; i > 0; --i)
fprintf(fout, "%d", b[i]);
return 0;
}