Saturday, August 27, 2011

[UVa] 10759 - Fibonacci Numbers

Done using my BigNum class, you can find that in [Projects] tag.

BigNum a[5000];

int main()
{
    int i, q;

    a[0].setNum("1",3000);
    a[1].setNum("1",3000);
    for (i=2 ; i<4790 ; i++)
    {
        a[i].setNum("0",3000);
        a[i].add(&a[i-2],&a[i-1],&a[i]);
    }


    while (scanf("%d",&q)!=EOF)
    {
        a[q-1].print();
    }

    return 0;
}

No comments:

Post a Comment

Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...