蓝桥第十届前三项和

#include<iostream>

using namespace std;
//3361
int a[30000000];
int main(){
int N = 30;
a[1] = a[2] = a[3] = 1;
for(int i = 4;i <= N;i++){
a[i] = (a[i - 1] +a[i - 2] + a[i - 3]);
cout << a[i - 1] << " " << a[i - 2] << " " << a[i - 3] << endl;
}

cout << a[N] << endl;
}

猜你喜欢

转载自www.cnblogs.com/luyuan-chen/p/11907818.html