Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

没人发帖 好纠结 。。。

Posted by qqgyp at 2011-05-28 10:25:47 on Problem 3797
#include <iostream>
using namespace std;

int main()
{
    int f[20];
    int a[20];
    int b[20];
    
    int n;
    f[0]=1;f[1]=1;a[0]=0;a[1]=1;b[0]=0;b[1]=1;
    int i;
    for(i=2;i<20;i++)
    {
        f[i] = f[i-1] + f[i-2] + a[i-1] + 2*b[i-1];
        a[i] = f[i-1] + a[i-2];
        b[i] = f[i-1] + b[i-1];                
    }
    cin>>n;
    int j=0;
    while(j<n)
    {
              cin>>i;
              cout<<++j<<" "<<f[i]<<endl;
              }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator