文章
55
粉丝
100
获赞
12
访问
29.8k
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
using namespace std;
int dp[1005] = {0};
int floor(int n){
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
for(int i = 4; i<=n; i++){
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
}
return dp[n];
}
int main(){
int n;
while(cin>>n){
int res = floor(n);
cout<<res<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发