http://acm.hust.edu.cn/vjudge/contest/view.action?cid=31329#problem/C
找规律:f[ i ] = 4 * f[ i - 2 ] - f[ i - 4 ] ,f[ 0 ] = 1 , f[ 2 ] = 3 ;
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<ctime>
#include<deque>
#include<stack>
#include<bitset>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<numeric>
#include<sstream>
#include<utility>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std ;
const int maxn = 35 ;
long long f[ maxn ] ;
void Union()
{
f[ 0 ] = 1 ;
f[ 2 ] = 3 ;
for( int i = 4 ; i <= 30 ; i += 2 )
{
f[ i ] = 4 * f[ i - 2 ] - f[ i - 4 ] ;
}
}
int main()
{
long long n ;
Union() ;
while( scanf( "%lld" , &n ) != EOF )
{
if( n < 0 )
break ;
printf( "%lld\n" , f[ n ] ) ;
}
return 0 ;
}