| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
此题实际上是fibonacci数列的变形/*附代码 0ms*/
#include <cstdio>
using namespace std;
int n,k,t;
int f[105];
int main()
{
f[0]=1;f[1]=2;
for(int i=2;i<=45;i++)f[i]=f[i-1]+f[i-2];
scanf("%d",&n);t=0;
while(n--)
{
t++;
scanf("%d",&k);
printf("Scenario #%d:\n%d\n\n",t,f[k]);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator