文章
79
粉丝
221
获赞
46
访问
198.2k
#include <iostream>
using namespace std;
int main() {
int n;
long long a[71];
while (cin >> n) {
for (int i = 0; i <= n; i++) {
if (i == 0 || i == 1) {
a[i] = 1;
continue;
}
if (i == 2) {
a[i] = 2;
continue;
}
a[i] = a[i - 1] + a[i - 2] + a[i - 3];
}
cout << a[n] << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发