题解 | #Fibonacci#
Fibonacci
https://www.nowcoder.com/practice/17ad6908e36a49f4b06ea96936e8bb25
#include <iostream> using namespace std; int main() { int n; cin>>n; int a=0,b=1; while(n--){ int c=a+b; a=b; b=c; } cout<<a<<endl; }
Fibonacci
https://www.nowcoder.com/practice/17ad6908e36a49f4b06ea96936e8bb25
#include <iostream> using namespace std; int main() { int n; cin>>n; int a=0,b=1; while(n--){ int c=a+b; a=b; b=c; } cout<<a<<endl; }
相关推荐