Xies_X @ 2024-11-15 09:48:52
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
if (n==0) {
cout <<1<< endl;
return 0;
}
if (n==1) {
cout <<1<< endl;
return 0;
}
if (n==2) {
cout <<2<<endl;
return 0;
}
int dp[n+1];
dp[0] = 1;
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= n; i++)
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
cout <<dp[n]<<endl;
return 0;
}
by Xies_X @ 2024-11-15 09:49:48
应该和acwing上的题一样啊,这个?在上面a了
by 幻想繁星 @ 2024-11-15 09:51:55
@Xies_X
by Xies_X @ 2024-11-15 09:55:03
@幻想繁星ok