#1232. 数论与位运算·单选训练1(3)

数论与位运算·单选训练1(3)

数论与位运算·单选训练1(3)

第 1 题(单选)

下面的代码片段用于计算斐波那契数列。该代码的时间复杂度是 ( ) ?

[]int fibonacci(int n) { if (n  b ? a : b; int small = a < b ? a : b; if (big % small ==
0) {
return small; }
return gcd(small, big % small); }

{{ select(1) }}

  • gcd(24, 36)、gcd(24, 12)、gcd(12, 0)
  • gcd(24, 36)、gcd(12, 24)、gcd(0, 12) []
  • gcd(24, 36)、gcd(24, 12)
  • gcd(24, 36)、gcd(12, 24)