100%
2025-03-29 11:45:05
发布于:四川
2阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
long long a[30];
int main(){
a[1] = 1;
a[2] = 2;
a[3] = 4;
for(int i = 4; i <= 20;i++){
a[i] = a[i - 1] + a[i - 2]+a[i - 3];
}
while(1){
int x;
cin >> x;
if(x==0){
break;
}
cout << a[x] << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个