斐波那契数列
斐波那契数列
http://www.nowcoder.com/questionTerminal/c6c7742f5ba7442aada113136ddea0c3
class Solution { public: int Fibonacci(int n) { int f = 0, g = 1; while (0 < n--) { g += f; f = g - f; } return f; } };
斐波那契数列
http://www.nowcoder.com/questionTerminal/c6c7742f5ba7442aada113136ddea0c3
class Solution { public: int Fibonacci(int n) { int f = 0, g = 1; while (0 < n--) { g += f; f = g - f; } return f; } };
相关推荐