/* Name: NYOJ--491--幸运三角形 Author: shen_渊 Date: 15/04/17 16:26 Description: DFS超时,深搜出第一行的所有情况,计算之后打表水过 0,0,0,4,6,0,0,12,40,0,0,171,410,0,0,1896,5160,0,0,32757 */ #include<iostream> #include<cstring> using namespace std; const char ADD = '+'; const char SUB = '-'; void dfs(int); void cal(); int n,counter; string str; int main() { // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); while(cin>>n){ counter = ; str = ""; dfs(); cout<<counter<<endl; } ; } void dfs(int ct){ if(ct == n){ cal(); return; }else{ str[ct] = ADD; dfs(ct+); str[ct] = SUB; dfs(ct+); } } void cal(){ int t = n; ,sums=; while(t){ int i; ; i<t; ++i){ if(str[i] == ADD)suma++; else sums++; } ; i<t-; ++i){ ])str[i] = ADD; else str[i] = SUB; } t--; } if(suma == sums)counter++; } #include<iostream> using namespace std; ] = {,,,,,,,,,,,,,,,,,,,}; int main() { int n; ios::sync_with_stdio(false); while(cin>>n){ cout<<arr[n]<<endl; } ; }