题目来源:码蹄集
https://matiji.net/exam/brushquestion/279/778/B3FCFEC101BD05189BB74D522E019504
参考程序:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
#define N 1000
#define ll long long
int main(){
int n;
cin >> n;
int a = 1, b = 0, a1 , b1;
for (int i = 1; i <= n; i++){
a1 = b;
b1 = a * 3 + b * 2;
a = a1;
b = b1;
}
cout << a <<" " << b;
return 0;
}
//一个α粒子可以产生3个β粒子,而一个β粒子可以产生1个α粒子和2个β粒