一开始打了个表 发现 a[i] = a[i-3]+a[i-2];
#include#include #include using namespace std;int n,a[100] = {0, 1, 2, 2};void init(){ for(int i = 4; i < 80; i++) a[i] = a[i-3]+a[i-2];}int main(void){ init(); while(scanf("%d",&n) == 1) printf("%d\n",a[n]); return 0;}