标签:str i++ cpp 分享 alt desc des put sam
找规律,斐波那契数列
千万不能用函数!
千万不能用函数!
千万不能用函数!
绝对绝对绝对超时
#include <iostream> using namespace std; int main(void) { long long a, b, c; long long func(long long); while(cin >> a) { b = 1; c = 2; for(int i = 2; i < a; i++) { c += b; b = c - b; } if(a == 1) a = b; else if(a == 2) a = c; else a = c; cout << a << endl; } return 0; }
标签:str i++ cpp 分享 alt desc des put sam
原文地址:http://www.cnblogs.com/limyel/p/7159777.html