Cod sursa(job #2051436)

Utilizator GiosinioGeorge Giosan Giosinio Data 28 octombrie 2017 23:22:35
Problema Nunta Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>
#define LMAX 210
using namespace std;
ifstream f("nunta.in");
ofstream g("nunta.out");

unsigned char A[LMAX],B[LMAX];
int main()
{
    unsigned short int N,i,j,t;
    f>>N;
    A[0]=A[1]=B[0]=B[1]=1;
    for(i=2;i<=N;i++)
    {
        t=0;
        for(j=1;j<=B[0]||t;j++)
        {
            t+=A[j]+B[j];
            A[j]=B[j];
            B[j]=t%10;
            t/=10;
        }
        A[0]=B[0];
        B[0]=j-1;
    }
    for(i=B[0];i>=1;i--)
        g<<B[i]+'0';
}