網頁

2012年7月21日 星期六

a251: 假費波那契數

 /**********************************************************************************/
/*  Problem: a251 "假費波那契數" from 成功高中校內賽初賽 第一題 */
/*  Language: CPP (365 Bytes)                                                     */
/*  Result: AC(4ms, 374KB) judge by this@ZeroJudge                                */
/*  Author: monkey413 at 2012-07-21 11:10:34                                      */
/**********************************************************************************/
#include<iostream>
#include<algorithm>
using namespace std;
int T,N;
int table[20];
int main()
{
 while(cin>>T)
 {
  for(int i=0 ; i>N ;
   for(int j=0 ; j> table[j];
   for(int j=4 ; j<N ; ++j) table[j]=table[j-4]+table[j-1] ;
   sort(table,table+N) ;
   cout << table[N/2] << endl ;
  }
 }
 return 0;
}
簡易DP

沒有留言:

張貼留言