poj 1953 World Cup Noise

一道DP水题,主要是自己YY找出规律,就水!

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int p[46],i,n,d;
    p[1] = 2;
    p[2] = 3;
    for(i = 3;i < 46;i ++)
    p[i] = p[i-1] + p[i-2] ;
    i = 0;
    cin>>d;
    while(i < d)
    {
          cin>>n;
          printf("Scenario #%d:\n%d\n",++i,p[n]);
          if(i != d) cout<<endl;

    }
    return 0;
}


你可能感兴趣的:(poj 1953 World Cup Noise)