Pagini recente » Cod sursa (job #1636985) | Cod sursa (job #800090) | Cod sursa (job #2617269) | Cod sursa (job #1637155) | Cod sursa (job #552931)
Cod sursa(job #552931)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
fstream fin ("nunta.in", ios::in);
fstream fout ("nunta.out", ios::out);
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define BASE 10
typedef int Huge[100];
Huge a, b;
int main ()
{
int n;
fin >> n;
a[0] = b[0] = 1 = a[1] = b[1] = 1;
for (int i = 1; i < n; ++i) {
int t = 0, c;
a[0] = b[0];
for (int j = 1; j <= b[0]; ++j) {
c = (a[j] + b[j] + t) % BASE;
t = (a[j] + b[j] + t) / BASE;
a[j] = b[j], b[j] = c;
}
if (t) {
b[++b[0]] = t;
}
}
for (int i = b[0]; i; --i) {
fout << b[i];
}
fout << endl;
fin.close ();
fout.close ();
return 0;
}