利用动态规划实现,斐波那契数列:1 1 2 3 5 8 13 .....
#include <math.h>
#include <string.h>
#include<stdlib.h>
int main()
{
int n;
while (scanf("%d",&n) != EOF){
int first = 1,second = 1;
int third;
for ( int i = 2;i <= n;i++ ){
third = first + second;
first = second;
second = third;
}
printf("%d\n",second);
}
}