【HDOJ】2046 骨牌铺方格
Fibonacci数列,简单递推。
#include <stdio.h> #define MAXNUM 55 long long kinds[MAXNUM] = {1,1}; int main() { int i; int n; for (i=2; i<MAXNUM; ++i) kinds[i] = kinds[i-1] + kinds[i-2]; while (scanf("%d", &n) != EOF) { printf("%I64d\n", kinds[n]); } return 0; }