已知b0=1,b1=2,b2=3,bi=b(i-1)-b(i-2)+b(i-3),求b20,用c++表示出来
时间: 2023-04-09 09:02:29 浏览: 103
C++20 in Examples
b20 = -6, 用C语言表示为:
int b0 = 1, b1 = 2, b2 = 3, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20;
for (int i = 3; i <= 20; i++) {
b3 = b2 - b1 + b0;
b0 = b1;
b1 = b2;
b2 = b3;
}
b20 = b2 - b1 + b0;
阅读全文