1.2

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    const int zzh = 18;

    vector<int> ceshi(zzh);

    ceshi[0] = 1;
    ceshi[1] = 2;

    for (int i = 2; i < zzh; i++)
        ceshi[i] = 2 * ceshi[i-1] + ceshi[i-2];


    cout << "以下是佩尔数列的前 " << ceshi.size() << " 位:" << endl;


    for (int i = 0; i < zzh; i++)

    cout << ceshi[i] << " ";

    cout << endl;

    return 0;
}

 

版权声明:
作者:maple
链接:https://www.maplezeroz.com/?p=144
来源:我的学习笔记
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
海报
1.2
#include <iostream> #include <vector> using namespace std; int main() { const int zzh = 18; vector<int> ceshi(zz……
1.1
<<上一篇
下一篇>>