Problem Description
Input
Output
Sample Input
1 3 2
Sample Output
1 3 2
Hint
Source
HDU LCY
简单递推题目,需推出arr[i]=arr[i-1]+arr[i-2];
AC代码
#include <cstdio>
#include <iostream>
using namespace std;
long long arr[100];
int main()
{
arr[1]=1,arr[2]=2;
for(int i=3;i<100;i++)
arr[i]=arr[i-1]+arr[i-2];
int n;
while(cin>>n)
cout<<arr[n]<<endl;
return 0;
}
文章来源: 骨牌铺方格