文章目录
- AcWing 717. 简单斐波那契
- AC代码
AcWing 717. 简单斐波那契
本题链接:AcWing 717. 简单斐波那契
本博客给出本题截图:
AC代码
代码:
#include <iostream> using namespace std; int main() { int n; cin >> n; int a = 0, b = 1; for (int i = 0; i < n; i ++ ) { cout << a << ' '; int c = a + b; a = b; b = c; } cout << endl; return 0; }