2014年6月14日 星期六

d013

#include
#include
#include

int main(void) {
    char s[999];
    unsigned long int store[100];
    int num;
    int i;
    while( gets(s)!=0 ) {
        memset(store, 0, 100);
        num = atoi(s);
        store[0]=1;
        store[1]=1;
        for (i=2; i
            store[i] = store[i-2]+store[i-1];
        }
        printf("%lu\n",store[num-1]);
    }
    return 0;

}

tip:
1.當數字太大時的儲存與表示方法
http://stackoverflow.com/questions/3209909/how-to-printf-unsigned-long-in-c

沒有留言: